Module: kamailio
Branch: master
Commit: 68de38d51fb3773fbc5dbce0068bec1597783386
URL: 
https://github.com/kamailio/kamailio/commit/68de38d51fb3773fbc5dbce0068bec1597783386

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-02-07T07:52:19+01:00

dispatcher: switch to ksr_xrand() to be able to use custom rand function

---

Modified: src/modules/dispatcher/dispatch.c
Modified: src/modules/dispatcher/dispatch.h

---

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

---

diff --git a/src/modules/dispatcher/dispatch.c 
b/src/modules/dispatcher/dispatch.c
index ca1636edbd2..9968eab5537 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -57,6 +57,7 @@
 #include "../../core/script_cb.h"
 #include "../../core/kemi.h"
 #include "../../core/fmsg.h"
+#include "../../core/rand/ksrxrand.h"
 
 #include "ds_ht.h"
 #include "api.h"
@@ -790,7 +791,7 @@ void shuffle_uint100array(unsigned int *arr)
        if(arr == NULL)
                return;
        for(j = 0; j < 100; j++) {
-               k = j + (kam_rand() % (100 - j));
+               k = j + (ksr_xrand() % (100 - j));
                t = arr[j];
                arr[j] = arr[k];
                arr[k] = t;
@@ -807,7 +808,7 @@ void shuffle_char100array(char *arr)
        if(arr == NULL)
                return;
        for(j = 0; j < 100; j++) {
-               k = j + (kam_rand() % (100 - j));
+               k = j + (ksr_xrand() % (100 - j));
                t = arr[j];
                arr[j] = arr[k];
                arr[k] = t;
@@ -2614,7 +2615,7 @@ int ds_manage_routes(sip_msg_t *msg, ds_select_state_t 
*rstate)
                        }
                        break;
                case DS_ALG_RANDOM: /* 6 - random selection */
-                       hash = kam_rand();
+                       hash = ksr_xrand();
                        break;
                case DS_ALG_HASHPV: /* 7 - hash on PV value */
                        if(ds_hash_pvar(msg, &hash) != 0) {
diff --git a/src/modules/dispatcher/dispatch.h 
b/src/modules/dispatcher/dispatch.h
index b0d37bce288..c72b53bc7e2 100644
--- a/src/modules/dispatcher/dispatch.h
+++ b/src/modules/dispatcher/dispatch.h
@@ -35,7 +35,6 @@
 #include "../../core/pvar.h"
 #include "../../core/xavp.h"
 #include "../../core/parser/msg_parser.h"
-#include "../../core/rand/kam_rand.h"
 #include "../../modules/tm/tm_load.h"
 
 

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to