Browse code

core: start wtimer

Daniel-Constantin Mierla authored on 21/01/2016 13:36:45
Showing 1 changed files
... ...
@@ -132,6 +132,7 @@
132 132
 #include "sock_ut.h"
133 133
 #include "async_task.h"
134 134
 #include "dset.h"
135
+#include "timer_proc.h"
135 136
 
136 137
 #ifdef DEBUG_DMALLOC
137 138
 #include <dmalloc.h>
... ...
@@ -1302,6 +1303,7 @@ int main_loop(void)
1302 1302
 		cfg_register_child(
1303 1303
 				1   /* main = udp listener */
1304 1304
 				+ 1 /* timer */
1305
+				+ 1 /* wtimer */
1305 1306
 #ifdef USE_SLOW_TIMER
1306 1307
 				+ 1 /* slow timer */
1307 1308
 #endif
... ...
@@ -1371,6 +1373,10 @@ int main_loop(void)
1371 1371
 				}else{
1372 1372
 				}
1373 1373
 
1374
+		if(sr_wtimer_start()<0) {
1375
+			LM_CRIT("Cannot start wtimer\n");
1376
+			goto error;
1377
+		}
1374 1378
 		/* main process, receive loop */
1375 1379
 		process_no=0; /*main process number*/
1376 1380
 		pt[process_no].pid=getpid();
... ...
@@ -1402,6 +1408,7 @@ int main_loop(void)
1402 1402
 		 * will be added later.) */
1403 1403
 		cfg_register_child(
1404 1404
 				1   /* timer */
1405
+				+ 1   /* wtimer */
1405 1406
 #ifdef USE_SLOW_TIMER
1406 1407
 				+ 1 /* slow timer */
1407 1408
 #endif
... ...
@@ -1664,6 +1671,10 @@ int main_loop(void)
1664 1664
 			if (arm_timer()<0) goto error;
1665 1665
 			timer_main();
1666 1666
 		}
1667
+		if(sr_wtimer_start()<0) {
1668
+			LM_CRIT("Cannot start wtimer\n");
1669
+			goto error;
1670
+		}
1667 1671
 
1668 1672
 	/* init childs with rank==MAIN before starting tcp main (in case they want
1669 1673
 	 * to fork  a tcp capable process, the corresponding tcp. comm. fds in
... ...
@@ -1788,6 +1799,7 @@ static int calc_proc_no(void)
1788 1788
 #ifdef USE_SLOW_TIMER
1789 1789
 		+ 1 /* slow timer process */
1790 1790
 #endif
1791
+		+ 1 /* wtimer process */
1791 1792
 #ifdef USE_TCP
1792 1793
 		+((!tcp_disable)?( 1/* tcp main */ + tcp_listeners ):0)
1793 1794
 #endif
... ...
@@ -1911,6 +1923,7 @@ int main(int argc, char** argv)
1911 1911
 #ifdef USE_TCP
1912 1912
 	init_tcp_options(); /* set the defaults before the config */
1913 1913
 #endif
1914
+
1914 1915
 	/* process command line (cfg. file path etc) */
1915 1916
 	optind = 1;  /* reset getopt */
1916 1917
 	/* switches required before script processing */
... ...
@@ -2449,6 +2462,12 @@ try_again:
2449 2449
 		LM_CRIT("could not initialize timer, exiting...\n");
2450 2450
 		goto error;
2451 2451
 	}
2452
+	/* init wtimer */
2453
+	if(sr_wtimer_init()<0) {
2454
+		LM_CRIT("could not initialize wtimer, exiting...\n");
2455
+		goto error;
2456
+	}
2457
+
2452 2458
 #ifdef USE_DNS_CACHE
2453 2459
 	if (init_dns_cache()<0){
2454 2460
 		LM_CRIT("could not initialize the dns cache, exiting...\n");