Module: kamailio
Branch: 4.4
Commit: 40cce572ebb30dd63470ab59e15e8751c655f4a2
URL:
https://github.com/kamailio/kamailio/commit/40cce572ebb30dd63470ab59e15e875…
Author: jchavanton <jchavanton(a)flowroute.com>
Committer: Julien Chavanton <jchavanton(a)gmail.com>
Date: 2017-03-10T13:47:42-08:00
dmq_usrloc: adjust locking sequence
to avoid dead-lock
get_urecord_by_ruid returns with the lock if the record was found
---
Modified: modules/dmq_usrloc/usrloc_sync.c
---
Diff:
https://github.com/kamailio/kamailio/commit/40cce572ebb30dd63470ab59e15e875…
Patch:
https://github.com/kamailio/kamailio/commit/40cce572ebb30dd63470ab59e15e875…
---
diff --git a/modules/dmq_usrloc/usrloc_sync.c b/modules/dmq_usrloc/usrloc_sync.c
index 63e664b..c9c02bf 100644
--- a/modules/dmq_usrloc/usrloc_sync.c
+++ b/modules/dmq_usrloc/usrloc_sync.c
@@ -61,8 +61,6 @@ static int add_contact(str aor, ucontact_info_t* ci)
return -1;
}
- dmq_ul.lock_udomain(_d, &aor);
-
LM_DBG("aor: %.*s\n", aor.len, aor.s);
LM_DBG("ci->ruid: %.*s\n", ci->ruid.len, ci->ruid.s);
LM_DBG("aorhash: %i\n", dmq_ul.get_aorhash(&aor));
@@ -80,6 +78,7 @@ static int add_contact(str aor, ucontact_info_t* ci)
return 0;
}
}
+ dmq_ul.lock_udomain(_d, &aor);
res = dmq_ul.get_urecord(_d, &aor, &r);
if (res < 0) {
LM_ERR("failed to retrieve record from usrloc\n");