[OpenSIPS-Devel] [OpenSIPS/opensips] bf4c8a: Update drouting.c

nexbridge noreply at github.com
Thu Mar 16 06:52:54 UTC 2023

  Branch: refs/heads/3.2
  Home:   https://github.com/OpenSIPS/opensips
  Commit: bf4c8a9426a6211993acf342136a87bc0847c890
  Author: nexbridge <13848887+nexbridge at users.noreply.github.com>
  Date:   2023-03-16 (Thu, 16 Mar 2023)

  Changed paths:
    M modules/drouting/drouting.c

  Log Message:
  Update drouting.c

In weight_based_sort() function:

- Changed RAND_MAX to RAND_MAX + 1 to make sure that quotient is always less than 1
- Changed float to double to avoid rounding errors, particularly when the value of rand() nears RAND_MAX and thus the quotient could round to 1

(cherry picked from commit 6ef8168a8de88d04512b3aa6bb888ac3794fb142)

More information about the Devel mailing list