[sr-dev] git:master: pipelimit: update the limit of pipe for pl_check(pipeid, alg, limit)

Alex Balashov abalashov at evaristesys.com
Sun Nov 2 21:28:44 CET 2014


Thank you, Daniel! This works very well.

On 10/30/2014 05:31 PM, Daniel-Constantin Mierla wrote:

> Module: sip-router
> Branch: master
> Commit: 280f947eac5c66bfa6151c75983ffa9e533dd709
> URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=280f947eac5c66bfa6151c75983ffa9e533dd709
>
> Author: Daniel-Constantin Mierla <miconda at gmail.com>
> Committer: Daniel-Constantin Mierla <miconda at gmail.com>
> Date:   Thu Oct 30 22:29:01 2014 +0100
>
> pipelimit: update the limit of pipe for pl_check(pipeid, alg, limit)
>
> - affects the dynamic pipes that could have been created by same
>    function on a previous execution, allowing to be on-the-fly updated
> - reported by Alex Balashov
>
> ---
>
>   modules/pipelimit/pipelimit.c |    9 ++++++---
>   1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/modules/pipelimit/pipelimit.c b/modules/pipelimit/pipelimit.c
> index 3e6b918..a060df7 100644
> --- a/modules/pipelimit/pipelimit.c
> +++ b/modules/pipelimit/pipelimit.c
> @@ -625,9 +625,9 @@ static int w_pl_check3(struct sip_msg* msg, char *p1pipe, char *p2alg,
>   	if(msg==NULL)
>   		return -1;
>
> -	if(fixup_get_ivalue(msg, (gparam_t*)p3limit, &limit)!=0 || limit<=0)
> +	if(fixup_get_ivalue(msg, (gparam_t*)p3limit, &limit)!=0 || limit<0)
>   	{
> -		LM_ERR("invalid limit value\n");
> +		LM_ERR("invalid limit value: %d\n", limit);
>   		return -1;
>   	}
>
> @@ -645,7 +645,7 @@ static int w_pl_check3(struct sip_msg* msg, char *p1pipe, char *p2alg,
>   		return -1;
>   	}
>
> -	pipe = pl_pipe_get(&pipeid, 0);
> +	pipe = pl_pipe_get(&pipeid, 1);
>   	if(pipe==NULL)
>   	{
>   		LM_DBG("pipe not found [%.*s] - trying to add it\n",
> @@ -663,6 +663,9 @@ static int w_pl_check3(struct sip_msg* msg, char *p1pipe, char *p2alg,
>   				pipeid.len, pipeid.s);
>   			return -2;
>   		}
> +	} else {
> +		if(limit>0) pipe->limit = limit;
> +		pl_pipe_release(&pipe->name);
>   	}
>
>   	return pl_check(msg, &pipeid);
>
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>


-- 
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States

Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/



More information about the sr-dev mailing list