summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2016-08-11 23:27:15 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-08-11 23:27:15 -0500
commitfb88244957a19354d0c6321c399cb655caa24800 (patch)
treedfcae70f966df015086d76a5ccba44ce1ddf56a2 /res
parent88e90db6599fd9cbe47e643044806b65e64f1115 (diff)
parent5ba6357be2a140e558ddc14b7669bb08d035944d (diff)
Merge "res_pjsip: Make aor named lock a mutex."
Diffstat (limited to 'res')
-rw-r--r--res/res_pjsip/location.c8
-rw-r--r--res/res_pjsip_registrar.c4
-rw-r--r--res/res_pjsip_registrar_expire.c4
3 files changed, 8 insertions, 8 deletions
diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c
index 46278dd0c..c0c4a1f15 100644
--- a/res/res_pjsip/location.c
+++ b/res/res_pjsip/location.c
@@ -209,12 +209,12 @@ struct ao2_container *ast_sip_location_retrieve_aor_contacts(const struct ast_si
struct ao2_container *contacts;
struct ast_named_lock *lock;
- lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_RWLOCK, "aor", ast_sorcery_object_get_id(aor));
+ lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_MUTEX, "aor", ast_sorcery_object_get_id(aor));
if (!lock) {
return NULL;
}
- ao2_wrlock(lock);
+ ao2_lock(lock);
contacts = ast_sip_location_retrieve_aor_contacts_nolock(aor);
ao2_unlock(lock);
ast_named_lock_put(lock);
@@ -368,12 +368,12 @@ int ast_sip_location_add_contact(struct ast_sip_aor *aor, const char *uri,
int res;
struct ast_named_lock *lock;
- lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_RWLOCK, "aor", ast_sorcery_object_get_id(aor));
+ lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_MUTEX, "aor", ast_sorcery_object_get_id(aor));
if (!lock) {
return -1;
}
- ao2_wrlock(lock);
+ ao2_lock(lock);
res = ast_sip_location_add_contact_nolock(aor, uri, expiration_time, path_info, user_agent,
via_addr, via_port, call_id,
endpoint);
diff --git a/res/res_pjsip_registrar.c b/res/res_pjsip_registrar.c
index a39dac676..f99a3b84d 100644
--- a/res/res_pjsip_registrar.c
+++ b/res/res_pjsip_registrar.c
@@ -525,12 +525,12 @@ static int register_aor(pjsip_rx_data *rdata,
struct ao2_container *contacts = NULL;
struct ast_named_lock *lock;
- lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_RWLOCK, "aor", aor_name);
+ lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_MUTEX, "aor", aor_name);
if (!lock) {
return PJ_TRUE;
}
- ao2_wrlock(lock);
+ ao2_lock(lock);
contacts = ast_sip_location_retrieve_aor_contacts_nolock(aor);
if (!contacts) {
ao2_unlock(lock);
diff --git a/res/res_pjsip_registrar_expire.c b/res/res_pjsip_registrar_expire.c
index 0d979a13f..61841a054 100644
--- a/res/res_pjsip_registrar_expire.c
+++ b/res/res_pjsip_registrar_expire.c
@@ -44,7 +44,7 @@ static int expire_contact(void *obj, void *arg, int flags)
struct ast_sip_contact *contact = obj;
struct ast_named_lock *lock;
- lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_RWLOCK, "aor", contact->aor);
+ lock = ast_named_lock_get(AST_NAMED_LOCK_TYPE_MUTEX, "aor", contact->aor);
if (!lock) {
return 0;
}
@@ -53,7 +53,7 @@ static int expire_contact(void *obj, void *arg, int flags)
* We need to check the expiration again with the aor lock held
* in case another thread is attempting to renew the contact.
*/
- ao2_wrlock(lock);
+ ao2_lock(lock);
if (ast_tvdiff_ms(ast_tvnow(), contact->expiration_time) > 0) {
ast_sip_location_delete_contact(contact);
}