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

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


Module: sip-router
Branch: master
Commit: 5235a1d6218e0bb16f6c9998789864635f54d03e
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5235a1d6218e0bb16f6c9998789864635f54d03e

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

---

 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 e6a0dea..a1306cc 100644
--- a/modules_k/rls/resource_notify.c
+++ b/modules_k/rls/resource_notify.c
@@ -744,9 +744,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 ee406de..62f9ebe 100644
--- a/modules_k/rls/rls_db.c
+++ b/modules_k/rls/rls_db.c
@@ -184,8 +184,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 441fdd7..5b6c45a 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