Module: sip-router
Branch: 3.3
Commit: 262982b13c887c15e4c5a4d667530aad3fb8801c
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=262982b…
Author: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley(a)crocodile-rcs.com>
Date: Tue Sep 11 12:53:58 2012 +0100
modules_k/presence: core_hash not used correctly to distribute notifier traffic
- Found and fixed by Hugh Waite @ Crocodile RCS Ltd
(cherry picked from commit 4b9aa7f144b8cf3e6da775563528913ed79e0553)
---
modules_k/presence/notify.c | 13 +++++++------
modules_k/presence/presence.c | 4 ++--
modules_k/presence/subscribe.c | 4 ++--
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/modules_k/presence/notify.c b/modules_k/presence/notify.c
index 4f5396d..d601acc 100644
--- a/modules_k/presence/notify.c
+++ b/modules_k/presence/notify.c
@@ -2223,9 +2223,9 @@ int set_wipeer_subs_updated(str *pres_uri, pres_ev_t *event, int
full)
update_cols[n_update_cols] = &str_updated_col;
update_vals[n_update_cols].type = DB1_INT;
update_vals[n_update_cols].nul = 0;
- update_vals[n_update_cols].val.int_val = core_hash(&callid,
- &from_tag, (pres_waitn_time * pres_notifier_poll_rate
- * pres_notifier_processes) - 1);
+ update_vals[n_update_cols].val.int_val =
+ core_hash(&callid, &from_tag, 0) % (pres_waitn_time *
+ pres_notifier_poll_rate * pres_notifier_processes);
n_update_cols++;
if (full)
@@ -2283,9 +2283,10 @@ int set_updated(subs_t *sub)
update_cols[0] = &str_updated_col;
update_vals[0].type = DB1_INT;
update_vals[0].nul = 0;
- update_vals[0].val.int_val = core_hash(&sub->callid, &sub->from_tag,
- (pres_waitn_time * pres_notifier_poll_rate
- * pres_notifier_processes) - 1);
+ update_vals[0].val.int_val =
+ core_hash(&sub->callid, &sub->from_tag, 0) %
+ (pres_waitn_time * pres_notifier_poll_rate
+ * pres_notifier_processes);
if (pa_dbf.use_table(pa_db, &active_watchers_table) < 0)
{
diff --git a/modules_k/presence/presence.c b/modules_k/presence/presence.c
index 118b4d2..0adec43 100644
--- a/modules_k/presence/presence.c
+++ b/modules_k/presence/presence.c
@@ -1407,9 +1407,9 @@ static int update_pw_dialogs_dbonlymode(subs_t* subs, subs_t**
subs_array)
* pres_notifier_processes));
} else {
db_vals[n_update_cols].val.int_val =
- core_hash(&subs->callid, &subs->from_tag,
+ core_hash(&subs->callid, &subs->from_tag, 0) %
(pres_waitn_time * pres_notifier_poll_rate
- * pres_notifier_processes) - 1);
+ * pres_notifier_processes);
}
n_update_cols++;
diff --git a/modules_k/presence/subscribe.c b/modules_k/presence/subscribe.c
index c8e9960..deeef3e 100644
--- a/modules_k/presence/subscribe.c
+++ b/modules_k/presence/subscribe.c
@@ -470,9 +470,9 @@ int update_subscription_notifier(struct sip_msg* msg, subs_t* subs,
*sent_reply= 0;
/* Set the notifier/update fields for the subscription */
- subs->updated = core_hash(&subs->callid, &subs->from_tag,
+ subs->updated = core_hash(&subs->callid, &subs->from_tag, 0) %
(pres_waitn_time * pres_notifier_poll_rate
- * pres_notifier_processes) - 1);
+ * pres_notifier_processes);
if (subs->event->type & WINFO_TYPE)
subs->updated_winfo = UPDATED_TYPE;
else if (subs->event->wipeer)