Browse Source

modules_k/dialog: Revert "Prevent 'unable to find dialog' WARN
messages caused by accessing a dialog in the "deleted" state".

The approach chosen was incomplete as it requires extending checks
of return values for all calls to get_dlg() and lookup_dlg()
against POINTER_CLOSED_MARKER. Otherwise, it may lead to server
crashes when code mistakes POINTER_CLOSED_MARKER for an existing
dialog. However, having to check against two return values
requires a lot of logic changes.

Therefore, a better approach will be taken in a follow-up commit.

This reverts commit 9b7f25d7196e41cbcc77c1d6e316cb1a8664ed81.
(cherry picked from commit 0723496c037d8e22210861d6a0e9041351097f63)

Timo Reimann 15 years ago
parent
commit
2e570f72f8

+ 2 - 0
modules_k/dialog/dlg_cb.c

@@ -43,6 +43,8 @@ static struct dlg_head_cbl* load_cbs = 0;
 static struct dlg_cb_params params = {NULL, DLG_DIR_NONE, NULL, NULL};
 
 
+#define POINTER_CLOSED_MARKER  ((void *)(-1))
+
 
 static void run_load_callback(struct dlg_callback *cb);
 

+ 1 - 5
modules_k/dialog/dlg_handlers.c

@@ -824,11 +824,7 @@ void dlg_onroute(struct sip_msg* req, str *route_params, void *param)
 				return;
 
 			dlg = lookup_dlg( h_entry, h_id);
-			if (dlg == POINTER_CLOSED_MARKER) {
-				LM_DBG("dialog marked for destruction, ignoring\n");
-				return;
-			}
-			else if (dlg==0) {
+			if (dlg==0) {
 				LM_WARN("unable to find dialog for %.*s "
 					"with route param '%.*s' [%u:%u]\n",
 					req->first_line.u.request.method.len,

+ 3 - 4
modules_k/dialog/dlg_hash.c

@@ -378,8 +378,7 @@ struct dlg_cell* lookup_dlg( unsigned int h_entry, unsigned int h_id)
 		if (dlg->h_id == h_id) {
 			if (dlg->state==DLG_STATE_DELETED) {
 				dlg_unlock( d_table, d_entry);
-				LM_DBG("dialog id=%u on entry %u marked for deletion\n", h_id, h_entry);
-				return POINTER_CLOSED_MARKER;
+				goto not_found;
 			}
 			dlg->ref++;
 			LM_DBG("ref dlg %p with 1 -> %d\n", dlg, dlg->ref);
@@ -419,9 +418,8 @@ static inline struct dlg_cell* internal_get_dlg(unsigned int h_entry,
 		/* Check callid / fromtag / totag */
 		if (match_dialog( dlg, callid, ftag, ttag, dir)==1) {
 			if (dlg->state==DLG_STATE_DELETED) {
-				LM_DBG("dialog callid='%.*s' marked for deletion\n", callid->len, callid->s);
 				dlg_unlock( d_table, d_entry);
-				return POINTER_CLOSED_MARKER;
+				goto not_found;
 			}
 			dlg->ref++;
 			LM_DBG("ref dlg %p with 1 -> %d\n", dlg, dlg->ref);
@@ -434,6 +432,7 @@ static inline struct dlg_cell* internal_get_dlg(unsigned int h_entry,
 
 	dlg_unlock( d_table, d_entry);
 
+not_found:
 	LM_DBG("no dialog callid='%.*s' found\n", callid->len, callid->s);
 	return 0;
 }

+ 0 - 2
modules_k/dialog/dlg_hash.h

@@ -83,8 +83,6 @@
 #define DLG_DIR_DOWNSTREAM     1 /*!< dialog has downstream direction */
 #define DLG_DIR_UPSTREAM       2 /*!< dialog has upstream direction */
 
-#define POINTER_CLOSED_MARKER  ((void *)(-1))
-
 
 /*! entries in the dialog list */
 struct dlg_cell