### 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` .