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

Daniel-Constantin Mierla miconda at gmail.com
Thu Oct 30 22:31:39 CET 2014


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);




More information about the sr-dev mailing list