[sr-dev] git:master:77a2fae7: dispatcher: ds_timer_mode - new param to specify the timer proc

Daniel-Constantin Mierla miconda at gmail.com
Sun Jan 24 13:38:29 CET 2016


Module: kamailio
Branch: master
Commit: 77a2fae782c5a4c8c5c25bd594ad68193e046a49
URL: https://github.com/kamailio/kamailio/commit/77a2fae782c5a4c8c5c25bd594ad68193e046a49

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-01-24T12:27:13+01:00

dispatcher: ds_timer_mode - new param to specify the timer proc

- if set to 0 (default), main timer is used
- if set to 1, secondary timer is used

---

Modified: modules/dispatcher/dispatcher.c

---

Diff:  https://github.com/kamailio/kamailio/commit/77a2fae782c5a4c8c5c25bd594ad68193e046a49.diff
Patch: https://github.com/kamailio/kamailio/commit/77a2fae782c5a4c8c5c25bd594ad68193e046a49.patch

---

diff --git a/modules/dispatcher/dispatcher.c b/modules/dispatcher/dispatcher.c
index 376e768..f960297 100644
--- a/modules/dispatcher/dispatcher.c
+++ b/modules/dispatcher/dispatcher.c
@@ -47,6 +47,7 @@
 #include "../../error.h"
 #include "../../ut.h"
 #include "../../route.h"
+#include "../../timer_proc.h"
 #include "../../mem/mem.h"
 #include "../../mod_fix.h"
 #include "../../rpc.h"
@@ -114,6 +115,7 @@ int ds_hash_size = 0;
 int ds_hash_expire = 7200;
 int ds_hash_initexpire = 7200;
 int ds_hash_check_interval = 30;
+int ds_timer_mode = 0;
 
 str ds_outbound_proxy = {0, 0};
 
@@ -241,6 +243,7 @@ static param_export_t params[]={
 	{"ds_hash_check_interval", INT_PARAM, &ds_hash_check_interval},
 	{"outbound_proxy",  PARAM_STR, &ds_outbound_proxy},
 	{"ds_default_socket",  PARAM_STR, &ds_default_socket},
+	{"ds_timer_mode",      PARAM_INT, &ds_timer_mode},
 	{0,0,0}
 };
 
@@ -511,7 +514,13 @@ static int mod_init(void)
 			if(ds_hash_load_init(1<<ds_hash_size, ds_hash_expire,
 						ds_hash_initexpire)<0)
 				return -1;
-			register_timer(ds_ht_timer, NULL, ds_hash_check_interval);
+			if(ds_timer_mode==1) {
+				if(sr_wtimer_add(ds_ht_timer, NULL, ds_hash_check_interval)<0)
+					return -1;
+			} else {
+				if(register_timer(ds_ht_timer, NULL, ds_hash_check_interval)<0)
+					return -1;
+			}
 		} else {
 			LM_ERR("call load dispatching DSTID_AVP set but no size"
 					" for hash table (see ds_hash_size parameter)\n");
@@ -532,7 +541,13 @@ static int mod_init(void)
 		/*****************************************************
 		 * Register the PING-Timer
 		 *****************************************************/
-		register_timer(ds_check_timer, NULL, ds_ping_interval);
+		if(ds_timer_mode==1) {
+			if(sr_wtimer_add(ds_check_timer, NULL, ds_ping_interval)<0)
+				return -1;
+		} else {
+			if(register_timer(ds_check_timer, NULL, ds_ping_interval)<0)
+				return -1;
+		}
 	}
 
 	return 0;




More information about the sr-dev mailing list