[sr-dev] git:master: permissions(k): do not check db con in child init
Daniel-Constantin Mierla
miconda at gmail.com
Mon Jan 24 16:19:48 CET 2011
Hello,
On 1/24/11 2:36 PM, Alex Hermann wrote:
> Daniel,
>
> is the below change based on different DB behaviour in 3.1 than in 1.4/1.5
> or should this change be applied to 1.4/1.5 too?
no, the change is not for 1.x. In 3.1 is a safety check based on pid of
the process that opened the db connection, in order to be sure is not
shared by two processes, thus avoiding sync conflicts.
Cheers,
Daniel
>
>
> Alex.
>
>
> On Tuesday 18 January 2011, Daniel-Constantin Mierla wrote:
>> Module: sip-router
>> Branch: master
>> Commit: be92c6713c2b7c7cb04320758a346ba6a1324982
>> URL:
>> http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=be92
>> c6713c2b7c7cb04320758a346ba6a1324982
>>
>> Author: Daniel-Constantin Mierla<miconda at gmail.com>
>> Committer: Daniel-Constantin Mierla<miconda at gmail.com>
>> Date: Tue Jan 18 20:16:31 2011 +0100
>>
>> permissions(k): do not check db con in child init
>>
>> - proper connection is returned by comparison of pids
>>
>> ---
>>
>> modules_k/permissions/address.c | 2 +-
>> modules_k/permissions/trusted.c | 4 ++--
>> 2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/modules_k/permissions/address.c
>> b/modules_k/permissions/address.c index ccdbf1a..3db6e58 100644
>> --- a/modules_k/permissions/address.c
>> +++ b/modules_k/permissions/address.c
>> @@ -287,7 +287,7 @@ error:
>> */
>> int mi_init_addresses(void)
>> {
>> - if (!db_url.s || db_handle) return 0;
>> + if (!db_url.s) return 0;
>> db_handle = perm_dbf.init(&db_url);
>> if (!db_handle) {
>> LM_ERR("unable to connect database\n");
>> diff --git a/modules_k/permissions/trusted.c
>> b/modules_k/permissions/trusted.c index 33cae33..1f8a106 100644
>> --- a/modules_k/permissions/trusted.c
>> +++ b/modules_k/permissions/trusted.c
>> @@ -235,7 +235,7 @@ int init_child_trusted(int rank)
>> if ((rank<= 0)&& (rank != PROC_RPC)&& (rank != PROC_UNIXSOCK))
>> return 0;
>>
>> - if (!db_url.s || db_handle) {
>> + if (!db_url.s) {
>> return 0;
>> }
>>
>> @@ -261,7 +261,7 @@ int init_child_trusted(int rank)
>> */
>> int mi_init_trusted(void)
>> {
>> - if (!db_url.s || db_handle) return 0;
>> + if (!db_url.s) return 0;
>> db_handle = perm_dbf.init(&db_url);
>> if (!db_handle) {
>> LM_ERR("unable to connect database\n");
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
--
Daniel-Constantin Mierla
http://www.asipto.com
More information about the sr-dev
mailing list