Module: kamailio
Branch: master
Commit: de0c3195894ae5e20bc3bc3d88431b5043566cf2
URL:
https://github.com/kamailio/kamailio/commit/de0c3195894ae5e20bc3bc3d88431b5…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-04-14T15:20:24+02:00
presence: timer_mode - new parameter to control what timer process to use
- if set to 0, use the core main timer
- if set to 1, use the core secondary timer
- default 1 (timer tasks are for cleanup)
---
Modified: src/modules/presence/presence.c
---
Diff:
https://github.com/kamailio/kamailio/commit/de0c3195894ae5e20bc3bc3d88431b5…
Patch:
https://github.com/kamailio/kamailio/commit/de0c3195894ae5e20bc3bc3d88431b5…
---
diff --git a/src/modules/presence/presence.c b/src/modules/presence/presence.c
index 107563bbbc..3cbdab959a 100644
--- a/src/modules/presence/presence.c
+++ b/src/modules/presence/presence.c
@@ -102,6 +102,7 @@ str pres_server_address = {0, 0};
evlist_t *pres_evlist = NULL;
int pres_subs_remove_match = 0;
int _pres_subs_mode = 1;
+static int pres_timer_mode = 1;
int pres_uri_match = 0;
/* sip uri match function pointer */
@@ -241,6 +242,8 @@ static param_export_t params[]={
{ "enable_dmq", PARAM_INT, &pres_enable_dmq},
{ "pres_subs_mode", PARAM_INT, &_pres_subs_mode},
{ "delete_same_subs", PARAM_INT, &pres_delete_same_subs},
+ { "timer_mode", PARAM_INT, &pres_timer_mode},
+
{0,0,0}
};
/* clang-format on */
@@ -423,12 +426,21 @@ static int mod_init(void)
pres_startup_time = (int)time(NULL);
if(pres_clean_period > 0) {
- register_timer(msg_presentity_clean, 0, pres_clean_period);
- register_timer(msg_watchers_clean, 0, pres_clean_period);
+ if(pres_timer_mode==0) {
+ register_timer(msg_presentity_clean, 0, pres_clean_period);
+ register_timer(msg_watchers_clean, 0, pres_clean_period);
+ } else {
+ sr_wtimer_add(msg_presentity_clean, 0, pres_clean_period);
+ sr_wtimer_add(msg_watchers_clean, 0, pres_clean_period);
+ }
}
if(pres_db_update_period > 0) {
- register_timer(timer_db_update, 0, pres_db_update_period);
+ if(pres_timer_mode==0) {
+ register_timer(timer_db_update, 0, pres_db_update_period);
+ } else {
+ sr_wtimer_add(timer_db_update, 0, pres_db_update_period);
+ }
}
if(pres_waitn_time <= 0) {