From 7f9194c416e171c2b723430eb98a55a52b7b5e38 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Thu, 10 Sep 2015 00:21:14 +0200 Subject: [PATCH] dialog: lock the slot if old dialog found in state deleted - no longer a spiral condition and new dialog will be created --- modules/dialog/dlg_handlers.c | 4 +++- modules/dialog/dlg_hash.c | 16 +++++++++++++++- modules/dialog/dlg_hash.h | 7 +++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/modules/dialog/dlg_handlers.c b/modules/dialog/dlg_handlers.c index 17456863672..9f74e105ea1 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 78093d8baa2..75a0ed7c261 100644 --- a/modules/dialog/dlg_hash.c +++ b/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 diff --git a/modules/dialog/dlg_hash.h b/modules/dialog/dlg_hash.h index 22989767f5d..6b9e941aa32 100644 --- a/modules/dialog/dlg_hash.h +++ b/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