]> git.ipfire.org Git - thirdparty/freeswitch.git/commit
[mod_sofia] Randomize OPTIONS Ping interval 1413/head
authorJoseph Nadiv <ynadiv@corpit.xyz>
Sun, 31 Oct 2021 01:14:00 +0000 (21:14 -0400)
committeryois615 <ynadiv@corpit.xyz>
Sun, 20 Nov 2022 18:51:41 +0000 (13:51 -0500)
commit7afeceb47eece55449dc2e5d3b073ebd0232e8c1
treee151808d2af14baf816b8c4058ec16c4445c0673
parentbb682fc5b4c4fe67a340fdf9c3c7981d94bc1ca9
[mod_sofia] Randomize OPTIONS Ping interval

In FS-6400, the attempt was made to randomize OPTIONS
packets to be sent at a random interval.  The same random
interval is applied to all endpoints so this doesn't work.
Furthermore, rounding within the code, as well as
reseeding with srand() on each run will ultimately
make the ping times converge over time.  Once the
times converge, they will not separate since the reseeding
will cause the same random number to apply to each
registration.

This commmit will apply the random interval only during
initial registration and update of registration.
All subsequent pings will be incremented with the
actual value of ping-mean-interval. (This parameter
name is no longer accurate, and would be better named
ping-max-interval).

srand() has been moved to the start of the worker
thread, and all repeat calls have been removed,
so that each call of rand(), even during the
same second, generates a different random number.

Fixes #1132, Fixes #1133
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_presence.c
src/mod/endpoints/mod_sofia/sofia_reg.c