Explorar el Código

dialog: lock the slot if old dialog found in state deleted

- no longer a spiral condition and new dialog will be created
Daniel-Constantin Mierla hace 10 años
padre
commit
7f9194c416
Se han modificado 3 ficheros con 25 adiciones y 2 borrados
  1. 3 1
      modules/dialog/dlg_handlers.c
  2. 15 1
      modules/dialog/dlg_hash.c
  3. 7 0
      modules/dialog/dlg_hash.h

+ 3 - 1
modules/dialog/dlg_handlers.c

@@ -820,7 +820,9 @@ int dlg_new_dialog(sip_msg_t *req, struct cell *t, const int run_initial_cbs)
 				return 0;
 			}
 			dlg_release(dlg);
-        }
+		}
+		/* lock the slot - dlg found, but in dlg_state_deleted, do a new one */
+		dlg_hash_lock(&callid);
     }
     spiral_detected = 0;
 

+ 15 - 1
modules/dialog/dlg_hash.c

@@ -818,6 +818,21 @@ dlg_cell_t* search_dlg( str *callid, str *ftag, str *ttag, unsigned int *dir)
 }
 
 
+/*!
+ * \brief Lock hash table slot by call-id
+ * \param callid call-id value
+ */
+void dlg_hash_lock(str *callid)
+{
+	unsigned int he;
+	struct dlg_entry *d_entry;
+
+	he = core_hash(callid, 0, d_table->size);
+	d_entry = &(d_table->entries[he]);
+	dlg_lock(d_table, d_entry);
+}
+
+
 /*!
  * \brief Release hash table slot by call-id
  * \param callid call-id value
@@ -833,7 +848,6 @@ void dlg_hash_release(str *callid)
 }
 
 
-
 /*!
  * \brief Link a dialog structure
  * \param dlg dialog

+ 7 - 0
modules/dialog/dlg_hash.h

@@ -356,6 +356,13 @@ dlg_cell_t* get_dlg(str *callid, str *ftag, str *ttag, unsigned int *dir);
 dlg_cell_t* search_dlg(str *callid, str *ftag, str *ttag, unsigned int *dir);
 
 
+/*!
+ * \brief Lock hash table slot by call-id
+ * \param callid call-id value
+ */
+void dlg_hash_lock(str *callid);
+
+
 /*!
  * \brief Release hash table slot by call-id
  * \param callid call-id value