[sr-dev] git:master: dialog(k): remove second useless search of dlg by callid

Daniel-Constantin Mierla miconda at gmail.com
Fri May 4 14:03:57 CEST 2012


Module: sip-router
Branch: master
Commit: 8a5226f5ffb8508abdffbf342ff4b36ec321d39f
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8a5226f5ffb8508abdffbf342ff4b36ec321d39f

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Fri May  4 13:58:04 2012 +0200

dialog(k): remove second useless search of dlg by callid

- a second search was performed using to-tag as part of the hashing
  function, but it was never used to build the hash id

---

 modules_k/dialog/dlg_hash.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules_k/dialog/dlg_hash.c b/modules_k/dialog/dlg_hash.c
index e4d4f7c..9010139 100644
--- a/modules_k/dialog/dlg_hash.c
+++ b/modules_k/dialog/dlg_hash.c
@@ -674,11 +674,12 @@ static inline struct dlg_cell* internal_get_dlg(unsigned int h_entry,
 struct dlg_cell* get_dlg( str *callid, str *ftag, str *ttag, unsigned int *dir)
 {
 	struct dlg_cell *dlg;
+	unsigned int he;
 
-	if ((dlg = internal_get_dlg(core_hash(callid, 0,
-			d_table->size), callid, ftag, ttag, dir)) == 0 &&
-			(dlg = internal_get_dlg(core_hash(callid, ttag->len
-			?ttag:0, d_table->size), callid, ftag, ttag, dir)) == 0) {
+	he = core_hash(callid, 0, d_table->size);
+	dlg = internal_get_dlg(he, callid, ftag, ttag, dir);
+
+	if (dlg == 0) {
 		LM_DBG("no dialog callid='%.*s' found\n", callid->len, callid->s);
 		return 0;
 	}




More information about the sr-dev mailing list