[sr-dev] git:5.1:c931f285: dispatcher: Don't take modulus of hash twice

Henning Westerholt hw at kamailio.org
Tue Feb 5 21:29:07 CET 2019


Module: kamailio
Branch: 5.1
Commit: c931f2859a0762f48d41f1c2dbaf522d33c72cba
URL: https://github.com/kamailio/kamailio/commit/c931f2859a0762f48d41f1c2dbaf522d33c72cba

Author: Alex Hermann <alex at hexla.nl>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2019-02-05T21:25:17+01:00

dispatcher: Don't take modulus of hash twice

(cherry picked from commit 5b23ce265b43adda75731a90fdf1a3a47daa3a51)

---

Modified: src/modules/dispatcher/dispatch.c

---

Diff:  https://github.com/kamailio/kamailio/commit/c931f2859a0762f48d41f1c2dbaf522d33c72cba.diff
Patch: https://github.com/kamailio/kamailio/commit/c931f2859a0762f48d41f1c2dbaf522d33c72cba.patch

---

diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index bf99b7836e..e40d02e974 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -1878,7 +1878,7 @@ int ds_select_dst_limit(
 			}
 			break;
 		case DS_ALG_RANDOM: /* 6 - random selection */
-			hash = kam_rand() % idx->nr;
+			hash = kam_rand();
 			break;
 		case DS_ALG_HASHPV: /* 7 - hash on PV value */
 			if(ds_hash_pvar(msg, &hash) != 0) {




More information about the sr-dev mailing list