Module: sip-router
Branch: master
Commit: d4396716a7f0c0472f37e4ce7c39e04394925583
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d439671…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Thu Feb 23 22:56:46 2012 +0000
core: Setting max_while_loops to zero now allows infinite loops
- I wanted to be able to have a Kamailio process running a configuration route
all the time (sleeping itself using usleep). To do this I use rtimer to
create a mode one timer (with timeout of one second - so the route is run
very shortly after Kamailio starts).
- In the route for this timer I had a while(1) loop, but the max_while_loops
(defaulting to 100) meant that the loop wasn't really infinite.
- Now setting max_while_loops to zero disables the infinite loop check.
---
action.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/action.c b/action.c
index 6d22bf2..e044f65 100644
--- a/action.c
+++ b/action.c
@@ -1401,7 +1401,9 @@ match_cleanup:
ret=1;
while(!(flags & (BREAK_R_F|RETURN_R_F|EXIT_R_F)) &&
(rval_expr_eval_int(h, msg, &v, rve) == 0) && v){
- i++;
+ if (cfg_get(core, core_cfg, max_while_loops) > 0)
+ i++;
+
if (unlikely(i > cfg_get(core, core_cfg, max_while_loops))){
LOG(L_ERR, "ERROR: runaway while (%d, %d): more then"
" %d loops\n",