### Description
See `internal_get_dlg`: ```C static inline struct dlg_cell* internal_get_dlg(unsigned int h_entry, str* callid, str* ftag, str* ttag, unsigned int* dir, int mode) { struct dlg_cell* dlg; struct dlg_entry* d_entry;
d_entry = &(d_table->entries[h_entry]);
dlg_lock(d_table, d_entry);
for (dlg = d_entry->first ; dlg ; dlg = dlg->next) { /* Check callid / fromtag / totag */ if (match_dialog(dlg, callid, ftag, ttag, dir) == 1) { ref_dlg_unsafe(dlg, 1); if (likely(mode == 0)) { dlg_unlock(d_table, d_entry); } LM_DBG("dialog callid='%.*s' found on entry %u, dir=%d\n", callid->len, callid->s, h_entry, *dir); return dlg; } }
if (likely(mode == 0)) { dlg_unlock(d_table, d_entry); } LM_DBG("no dialog callid='%.*s' found\n", callid->len, callid->s); return 0; } ``` Should judge whether `mode` is 0 before `dlg_lock` .
Closed #3084.
The mode is about leaving the slot locked when != 0, the unlock has to be done by the code using this function.
Again, if you want to discuss about internal C code, use sr-dev@lists.kamailio.org mailing list. Do not open issues on this tracker about every piece of code you think its wrong.
If you get a deadlock or a crash because of some piece of code, then make a proper report, saying when/where it happened, with appropriate debug details as instructed in the issue template.
The mode is about leaving the slot locked when != 0, the unlock has to be done by the code using this function.
Again, if you want to discuss about internal C code, use [sr-dev@lists.kamailio.org](mailto:sr-dev@lists.kamailio.org) mailing list. Do not open issues on this tracker about every piece of code you think its wrong.
If you get a deadlock or a crash because of some piece of code, then make a proper report, saying when/where it happened, with appropriate debug details as instructed in the issue template.
Sorry... I'm looking forwarding to join the mailing list and waiting for the subscribed result.
By the way, I have reviewed the code again, and confused me again. See `dlg_new_dialog` in `dlg_handlers.c`. After `dlg_search`, the dlg has locked and referenced, but there is no `dlg_hash_release`/`dlg_release` in some places ?
Please move this discussion to the sr-dev mailing list as mentioned. You can easily subcribe, it just takes a few minutes.