Module: kamailio
Branch: master
Commit: 660bc9c34f169a915cba3a9b416fb93d63b01a22
URL:
https://github.com/kamailio/kamailio/commit/660bc9c34f169a915cba3a9b416fb93…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2016-11-10T11:46:56+01:00
presence: removed unnecessary global variable for implementation of startup mode
---
Modified: modules/presence/notify.c
Modified: modules/presence/presence.c
Modified: modules/presence/presence.h
Modified: modules/presence/presentity.c
---
Diff:
https://github.com/kamailio/kamailio/commit/660bc9c34f169a915cba3a9b416fb93…
Patch:
https://github.com/kamailio/kamailio/commit/660bc9c34f169a915cba3a9b416fb93…
---
diff --git a/modules/presence/notify.c b/modules/presence/notify.c
index d9a51ef..331dea1 100644
--- a/modules/presence/notify.c
+++ b/modules/presence/notify.c
@@ -653,7 +653,7 @@ str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag,
query_ops[n_query_cols] = OP_EQ;
n_query_cols++;
- if (pres_fix_startup) {
+ if (pres_startup_mode==1) {
query_cols[n_query_cols] = &str_expires_col;
query_vals[n_query_cols].type = DB1_INT;
query_vals[n_query_cols].nul = 0;
@@ -677,7 +677,7 @@ str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag,
} else {
query_str = str_received_time_col;
}
- if (pres_fix_startup) {
+ if (pres_startup_mode==1) {
if (pa_dbf.query (pa_db, query_cols, query_ops, query_vals,
result_cols, n_query_cols, n_result_cols, &query_str , &result) < 0)
{
diff --git a/modules/presence/presence.c b/modules/presence/presence.c
index bd46219..f91608c 100644
--- a/modules/presence/presence.c
+++ b/modules/presence/presence.c
@@ -160,8 +160,7 @@ int pres_waitn_time = 5;
int pres_notifier_poll_rate = 10;
int pres_notifier_processes = 1;
int pres_force_delete = 0;
-int startup_mode = 1; // enable by default
-int pres_fix_startup = 0;
+int pres_startup_mode = 1;
str pres_xavp_cfg = {0};
int pres_retrieve_order = 0;
str pres_retrieve_order_by = str_init("priority");
@@ -208,7 +207,7 @@ static param_export_t params[]={
{ "notifier_poll_rate", INT_PARAM, &pres_notifier_poll_rate },
{ "notifier_processes", INT_PARAM, &pres_notifier_processes },
{ "force_delete", INT_PARAM, &pres_force_delete },
- { "startup_mode", INT_PARAM, &startup_mode },
+ { "startup_mode", INT_PARAM, &pres_startup_mode },
{ "to_tag_pref", PARAM_STRING, &to_tag_pref },
{ "expires_offset", INT_PARAM, &expires_offset },
{ "max_expires", INT_PARAM, &max_expires },
@@ -446,10 +445,6 @@ static int mod_init(void)
if (pres_force_delete > 0)
pres_force_delete = 1;
- if (startup_mode > 0) {
- pres_fix_startup = 1; // startup_mode fixes presence on startup (commit:
1dceaa24ded727aba5870f28fb63e26ed98464f3)
- }
-
if (pres_log_facility_str) {
int tmp = str2facility(pres_log_facility_str);
diff --git a/modules/presence/presence.h b/modules/presence/presence.h
index 92cc6b3..ba4d65a 100644
--- a/modules/presence/presence.h
+++ b/modules/presence/presence.h
@@ -89,7 +89,7 @@ extern int pres_waitn_time;
extern int pres_notifier_poll_rate;
extern int pres_notifier_processes;
extern int pres_force_delete;
-extern int pres_fix_startup;
+extern int pres_startup_mode;
extern str pres_xavp_cfg;
extern int pres_retrieve_order;
extern str pres_retrieve_order_by;
diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c
index c59af2b..ff43f24 100644
--- a/modules/presence/presentity.c
+++ b/modules/presence/presentity.c
@@ -1253,7 +1253,8 @@ int pres_htable_restore(void)
row = &result->rows[i];
row_vals = ROW_VALUES(row);
- if (!pres_fix_startup && (row_vals[expires_col].val.int_val<
(int)time(NULL)))
+ if (pres_startup_mode!=0
+ && (row_vals[expires_col].val.int_val< (int)time(NULL)))
continue;
sphere= NULL;