[sr-dev] git:master:7f9194c4: dialog: lock the slot if old dialog found in state deleted

Daniel-Constantin Mierla miconda at gmail.com
Thu Sep 10 09:30:29 CEST 2015


Module: kamailio
Branch: master
Commit: 7f9194c416e171c2b723430eb98a55a52b7b5e38
URL: https://github.com/kamailio/kamailio/commit/7f9194c416e171c2b723430eb98a55a52b7b5e38

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-09-10T09:30:11+02:00

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

- no longer a spiral condition and new dialog will be created

---

Modified: modules/dialog/dlg_handlers.c
Modified: modules/dialog/dlg_hash.c
Modified: modules/dialog/dlg_hash.h

---

Diff:  https://github.com/kamailio/kamailio/commit/7f9194c416e171c2b723430eb98a55a52b7b5e38.diff
Patch: https://github.com/kamailio/kamailio/commit/7f9194c416e171c2b723430eb98a55a52b7b5e38.patch

---

diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c
index 1745686..9f74e10 100644
--- a/modules/dialog/dlg_handlers.c
+++ b/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;
 
diff --git a/modules/dialog/dlg_hash.c b/modules/dialog/dlg_hash.c
index 78093d8..75a0ed7 100644
--- a/modules/dialog/dlg_hash.c
+++ b/modules/dialog/dlg_hash.c
@@ -819,6 +819,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
diff --git a/modules/dialog/dlg_hash.h b/modules/dialog/dlg_hash.h
index 2298976..6b9e941 100644
--- a/modules/dialog/dlg_hash.h
+++ b/modules/dialog/dlg_hash.h
@@ -357,6 +357,13 @@ 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
  */




More information about the sr-dev mailing list