[sr-dev] git:master: pdb: avoid child re-init

Daniel-Constantin Mierla miconda at gmail.com
Thu Jul 1 19:35:47 CEST 2010


Hello,

please review the last commits on pdb and userblacklist modules to see 
if something was mistakenly broken. I updated them to avoid 
re-initialization that could be caused by usage of xmlrpc module for 
executing mi commands.

Should have been pretty much safe with the old version for pdb as the mi 
init child function was called 3 times anyhow (for each mi command).

In userblacklist I re-used mi_child_init() in child_init() as seemed to 
be same code.

Carrierroute was not affected, although exports mi command and requires 
mi child initialization, exiting db con is closed and a new is opened.

Thanks,
Daniel

On 7/1/10 7:21 PM, Daniel-Constantin Mierla wrote:
> Module: sip-router
> Branch: master
> Commit: bc34a82fbf5bd903cc50cb34c73afb7b685603a7
> URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bc34a82fbf5bd903cc50cb34c73afb7b685603a7
>
> Author: Daniel-Constantin Mierla<miconda at gmail.com>
> Committer: Daniel-Constantin Mierla<miconda at gmail.com>
> Date:   Thu Jul  1 19:19:17 2010 +0200
>
> pdb: avoid child re-init
>
> - for mi cmd when used over xmlrpc module
>
> ---
>
>   modules/pdb/pdb.c |    9 ++++++---
>   1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/modules/pdb/pdb.c b/modules/pdb/pdb.c
> index 9720a13..721363c 100644
> --- a/modules/pdb/pdb.c
> +++ b/modules/pdb/pdb.c
> @@ -667,17 +667,20 @@ static int mod_init(void)
>   	return 0;
>   }
>
> -
>   static int child_init (int rank)
>   {
> -	if (init_server_socket() != 0) return -1;
> -	return 0;
> +	return mi_child_init();
>   }
>
>
> +static int pdb_child_initialized = 0;
> +
>   static int mi_child_init(void)
>   {
> +	if(pdb_child_initialized)
> +		return 0;
>   	if (init_server_socket() != 0) return -1;
> +	pdb_child_initialized = 1;
>   	return 0;
>   }
>
>
>
> _______________________________________________
> 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