From: Mark Spencer Date: Sun, 30 Oct 2005 21:36:27 +0000 (+0000) Subject: Fix ability to do lots of outbound registrations (bug #5529) X-Git-Tag: 1.2.0-beta2~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39d27dbab8ad540a2620d9a54ef966b92c254413;p=thirdparty%2Fasterisk.git Fix ability to do lots of outbound registrations (bug #5529) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6897 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 8b538b5fd4..fb48e19f9f 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -12891,12 +12891,18 @@ static void sip_poke_all_peers(void) static void sip_send_all_registers(void) { int ms; - + int regspacing; + if (!regobjs) + return; + regspacing = default_expiry * 1000/regobjs; + if (regspacing > 100) + regspacing = 100; + ms = regspacing; ASTOBJ_CONTAINER_TRAVERSE(®l, 1, do { ASTOBJ_WRLOCK(iterator); if (iterator->expire > -1) ast_sched_del(sched, iterator->expire); - ms = (rand() >> 12) & 0x1fff; + ms += regspacing; iterator->expire = ast_sched_add(sched, ms, sip_reregister, iterator); ASTOBJ_UNLOCK(iterator); } while (0)