[sr-dev] git:5.3:47e41a7c: dialog: use the dlg hash table slot to unlock on dmq handling

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 2 09:55:44 CEST 2020


Module: kamailio
Branch: 5.3
Commit: 47e41a7cacab71f19e6c9c319d3ede83183e074d
URL: https://github.com/kamailio/kamailio/commit/47e41a7cacab71f19e6c9c319d3ede83183e074d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-07-02T09:42:39+02:00

dialog: use the dlg hash table slot to unlock on dmq handling

- the dlg can be destroyed on dmq replication and unlocking may fail

(cherry picked from commit f4036c535033a333cb551b5af70703135305e7b3)

---

Modified: src/modules/dialog/dlg_dmq.c

---

Diff:  https://github.com/kamailio/kamailio/commit/47e41a7cacab71f19e6c9c319d3ede83183e074d.diff
Patch: https://github.com/kamailio/kamailio/commit/47e41a7cacab71f19e6c9c319d3ede83183e074d.patch

---

diff --git a/src/modules/dialog/dlg_dmq.c b/src/modules/dialog/dlg_dmq.c
index fdca3f0f0a..a5628f485b 100644
--- a/src/modules/dialog/dlg_dmq.c
+++ b/src/modules/dialog/dlg_dmq.c
@@ -115,6 +115,7 @@ int dlg_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp, dmq_node_t* no
 	unsigned int state = 1;
 	srjson_t *vj;
 	int newdlg = 0;
+	dlg_entry_t *d_entry = NULL;
 
 	/* received dmq message */
 	LM_DBG("dmq message received\n");
@@ -219,6 +220,7 @@ int dlg_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp, dmq_node_t* no
 	dlg = dlg_get_by_iuid_mode(&iuid, 1);
 	if (dlg) {
 		LM_DBG("found dialog [%u:%u] at %p\n", iuid.h_entry, iuid.h_id, dlg);
+		d_entry = &(d_table->entries[dlg->h_entry]);
 		unref++;
 	}
 
@@ -396,9 +398,9 @@ int dlg_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp, dmq_node_t* no
 		if(unref) {
 			dlg_unref(dlg, unref);
 		}
-		if(newdlg == 0) {
-			dlg_cell_unlock(dlg);
-		}
+	}
+	if(newdlg == 0 && d_entry!=NULL) {
+		dlg_unlock(d_table, d_entry);
 	}
 
 	srjson_DestroyDoc(&jdoc);
@@ -414,10 +416,8 @@ int dlg_dmq_handle_msg(struct sip_msg* msg, peer_reponse_t* resp, dmq_node_t* no
 	return 0;
 
 error:
-	if (dlg) {
-		if(newdlg == 0) {
-			dlg_cell_unlock(dlg);
-		}
+	if(newdlg == 0 && d_entry!=NULL) {
+		dlg_unlock(d_table, d_entry);
 	}
 	srjson_DestroyDoc(&jdoc);
 	resp->reason = dmq_500_rpl;




More information about the sr-dev mailing list