Module: sip-router
Branch: 4.1
Commit: 8df9d2336e7de2648288cf8ff6821e6820d88da9
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=8df9d23…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Mon Dec 9 10:06:15 2013 +0100
usrloc: avoid double locking when preloading attributes
- reported by Seudin Kasumovic, FS#378
(cherry picked from commit 888635bfa3719afeeea6f5f0d407aa862ceb34ac)
---
modules/usrloc/udomain.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/usrloc/udomain.c b/modules/usrloc/udomain.c
index a736051..88fc7e4 100644
--- a/modules/usrloc/udomain.c
+++ b/modules/usrloc/udomain.c
@@ -1270,8 +1270,7 @@ int uldb_preload_attrs(udomain_t *_d)
suri = user;
}
- lock_udomain(_d, &suri);
- if (get_urecord_by_ruid(_d, ul_get_aorhash(&suri), &ruid, &r, &c) >
0) {
+ if (get_urecord_by_ruid(_d, ul_get_aorhash(&suri), &ruid, &r, &c) <
0) {
/* delete attrs records from db table */
LM_INFO("no contact record for this ruid\n");
uldb_delete_attrs(_d->name, &user, &domain, &ruid);
@@ -1287,8 +1286,9 @@ int uldb_preload_attrs(udomain_t *_d)
LM_INFO("cannot add values to contact xavp\n");
}
}
+ /* get_urecord_by_ruid() locks the slot */
+ unlock_udomain(_d, &suri);
}
- unlock_udomain(_d, &user);
}
if (DB_CAPABILITY(ul_dbf, DB_CAP_FETCH)) {