Module: kamailio
Branch: master
Commit: 72023c347c560c6f7d084c947cea9e9ca2ddce8e
URL:
https://github.com/kamailio/kamailio/commit/72023c347c560c6f7d084c947cea9e9…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: GitHub <noreply(a)github.com>
Date: 2016-11-01T14:55:54+01:00
Merge pull request #809 from Chocolatbuddha/master
Presence: Fix startup inconsistency in presentity hash table
---
Modified: modules/presence/notify.c
Modified: modules/presence/presentity.c
---
Diff:
https://github.com/kamailio/kamailio/commit/72023c347c560c6f7d084c947cea9e9…
Patch:
https://github.com/kamailio/kamailio/commit/72023c347c560c6f7d084c947cea9e9…
---
diff --git a/modules/presence/notify.c b/modules/presence/notify.c
index 82ebf6b..acb052d 100644
--- a/modules/presence/notify.c
+++ b/modules/presence/notify.c
@@ -584,8 +584,9 @@ str* build_empty_bla_body(str pres_uri)
str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag,
str* contact)
{
- db_key_t query_cols[3];
- db_val_t query_vals[3];
+ db_key_t query_cols[4];
+ db_val_t query_vals[4];
+ db_op_t query_ops[4];
db_key_t result_cols[3];
db1_res_t *result = NULL;
int body_col, etag_col= 0, sender_col;
@@ -635,18 +636,28 @@ str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag,
query_vals[n_query_cols].type = DB1_STR;
query_vals[n_query_cols].nul = 0;
query_vals[n_query_cols].val.str_val = uri.host;
+ query_ops[n_query_cols] = OP_EQ;
n_query_cols++;
query_cols[n_query_cols] = &str_username_col;
query_vals[n_query_cols].type = DB1_STR;
query_vals[n_query_cols].nul = 0;
query_vals[n_query_cols].val.str_val = uri.user;
+ query_ops[n_query_cols] = OP_EQ;
n_query_cols++;
query_cols[n_query_cols] = &str_event_col;
query_vals[n_query_cols].type = DB1_STR;
query_vals[n_query_cols].nul = 0;
query_vals[n_query_cols].val.str_val= event->name;
+ query_ops[n_query_cols] = OP_EQ;
+ n_query_cols++;
+
+ query_cols[n_query_cols] = &str_expires_col;
+ query_vals[n_query_cols].type = DB1_INT;
+ query_vals[n_query_cols].nul = 0;
+ query_vals[n_query_cols].val.int_val= (int)time(NULL);
+ query_ops[n_query_cols] = OP_GT;
n_query_cols++;
result_cols[body_col=n_result_cols++] = &str_body_col;
@@ -664,7 +675,7 @@ str* get_p_notify_body(str pres_uri, pres_ev_t* event, str* etag,
} else {
query_str = str_received_time_col;
}
- if (pa_dbf.query (pa_db, query_cols, 0, query_vals,
+ if (pa_dbf.query (pa_db, query_cols, query_ops, query_vals,
result_cols, n_query_cols, n_result_cols, &query_str , &result) < 0)
{
LM_ERR("failed to query %.*s table\n", presentity_table.len,
presentity_table.s);
diff --git a/modules/presence/presentity.c b/modules/presence/presentity.c
index cb819cf..4c8c914 100644
--- a/modules/presence/presentity.c
+++ b/modules/presence/presentity.c
@@ -1231,9 +1231,6 @@ int pres_htable_restore(void)
row = &result->rows[i];
row_vals = ROW_VALUES(row);
- if(row_vals[expires_col].val.int_val< (int)time(NULL))
- continue;
-
sphere= NULL;
user.s= (char*)row_vals[user_col].val.string_val;
user.len= strlen(user.s);