Browse code

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.

Peter Dunkley authored on 23/02/2012 22:56:46
Showing 1 changed files
... ...
@@ -1401,7 +1401,9 @@ match_cleanup:
1401 1401
 			ret=1;
1402 1402
 			while(!(flags & (BREAK_R_F|RETURN_R_F|EXIT_R_F)) &&
1403 1403
 					(rval_expr_eval_int(h, msg, &v, rve) == 0) && v){
1404
-				i++;
1404
+				if (cfg_get(core, core_cfg, max_while_loops) > 0)
1405
+					i++;
1406
+
1405 1407
 				if (unlikely(i > cfg_get(core, core_cfg, max_while_loops))){
1406 1408
 					LOG(L_ERR, "ERROR: runaway while (%d, %d): more then"
1407 1409
 								" %d loops\n",