[sr-dev] git:3.3: modules_k/rls: core_hash() not used correctly to distribute notifier traffic

Peter Dunkley peter.dunkley at crocodile-rcs.com
Tue Sep 11 14:33:29 CEST 2012


Module: sip-router
Branch: 3.3
Commit: 1fe1770aa372b6d22554428fb7172215e502b20c
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1fe1770aa372b6d22554428fb7172215e502b20c

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Tue Sep 11 13:06:54 2012 +0100

modules_k/rls: core_hash() not used correctly to distribute notifier traffic

- Found and fixed by Hugh Waite @ Crocodile RCS Ltd
(cherry picked from commit 5235a1d6218e0bb16f6c9998789864635f54d03e)

---

 modules_k/rls/resource_notify.c |    4 ++--
 modules_k/rls/rls_db.c          |    4 ++--
 modules_k/rls/subscribe.c       |    4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules_k/rls/resource_notify.c b/modules_k/rls/resource_notify.c
index 9c757ad..89f4e4f 100644
--- a/modules_k/rls/resource_notify.c
+++ b/modules_k/rls/resource_notify.c
@@ -720,9 +720,9 @@ int rls_handle_notify(struct sip_msg* msg, char* c1, char* c2)
 	query_vals[n_query_cols].nul = 0;
 	if (dbmode == RLS_DB_ONLY)
 		query_vals[n_query_cols].val.int_val=
-			core_hash(res_id, NULL,
+			core_hash(res_id, NULL, 0) %
 				(waitn_time * rls_notifier_poll_rate
-					* rls_notifier_processes) - 1);
+					* rls_notifier_processes);
 	else
 		query_vals[n_query_cols].val.int_val = UPDATED_TYPE;
 	n_query_cols++;
diff --git a/modules_k/rls/rls_db.c b/modules_k/rls/rls_db.c
index 97ac7d6..5728a2f 100644
--- a/modules_k/rls/rls_db.c
+++ b/modules_k/rls/rls_db.c
@@ -174,8 +174,8 @@ int delete_expired_subs_rlsdb( void )
 			LM_ERR("cannot build rls subs did\n");
 			goto error;
 		}
-		subs.updated = core_hash(&rlsubs_did, NULL,
-			(waitn_time * rls_notifier_poll_rate * rls_notifier_processes) - 1);
+		subs.updated = core_hash(&rlsubs_did, NULL, 0) %
+			(waitn_time * rls_notifier_poll_rate * rls_notifier_processes);
 
 		n_query_cols = 0;
 
diff --git a/modules_k/rls/subscribe.c b/modules_k/rls/subscribe.c
index c9577de..1126762 100644
--- a/modules_k/rls/subscribe.c
+++ b/modules_k/rls/subscribe.c
@@ -586,8 +586,8 @@ int rls_handle_subscribe(struct sip_msg* msg, str watcher_user, str watcher_doma
 		LM_ERR("cannot build rls subs did\n");
 		goto error;
 	}
-	subs.updated = core_hash(&rlsubs_did, NULL,
-		(waitn_time * rls_notifier_poll_rate * rls_notifier_processes) - 1);
+	subs.updated = core_hash(&rlsubs_did, NULL, 0) %
+		(waitn_time * rls_notifier_poll_rate * rls_notifier_processes);
 	
 	if(get_to(msg)->tag_value.s==NULL || get_to(msg)->tag_value.len==0)
 	{ /* initial Subscribe */




More information about the sr-dev mailing list