[sr-dev] git:4.3:061195f6: dialog: lock the slot if old dialog found in state deleted

Daniel-Constantin Mierla miconda at gmail.com
Thu Sep 10 14:01:47 CEST 2015


Module: kamailio
Branch: 4.3
Commit: 061195f6d553bad5edfc30db5c8da28d74421519
URL: https://github.com/kamailio/kamailio/commit/061195f6d553bad5edfc30db5c8da28d74421519

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-09-10T13:59:16+02:00

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

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

(cherry picked from commit 7f9194c416e171c2b723430eb98a55a52b7b5e38)

---

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/061195f6d553bad5edfc30db5c8da28d74421519.diff
Patch: https://github.com/kamailio/kamailio/commit/061195f6d553bad5edfc30db5c8da28d74421519.patch

---

diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c
index 248d985..ad88faa 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 420caea..b1639f1 100644
--- a/modules/dialog/dlg_hash.c
+++ b/modules/dialog/dlg_hash.c
@@ -750,6 +750,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
  */
@@ -764,7 +779,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 b09fe38..bacc21a 100644
--- a/modules/dialog/dlg_hash.h
+++ b/modules/dialog/dlg_hash.h
@@ -347,6 +347,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