Skip to content

Commit

Permalink
presence: removed unnecessary global variable for implementation of s…
Browse files Browse the repository at this point in the history
…tartup mode
  • Loading branch information
miconda committed Nov 10, 2016
1 parent 1f02100 commit 660bc9c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions modules/presence/notify.c
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down
9 changes: 2 additions & 7 deletions modules/presence/presence.c
Expand Up @@ -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");
Expand Down Expand Up @@ -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 },
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion modules/presence/presence.h
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion modules/presence/presentity.c
Expand Up @@ -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;
Expand Down

0 comments on commit 660bc9c

Please sign in to comment.