diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-06-27 18:00:09 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-06-27 18:00:09 +0000 |
commit | f563cf7b18126fbe5d49bd5d1a4dd366cbe5e424 (patch) | |
tree | 239af3433d50dde783fb2dd37eb9bdec0ee43d1e /channels/chan_sip.c | |
parent | 4db1f1d2f61499992acfc55b96d43a4f21414015 (diff) |
issue #7033 - Don't burst pokes to peers at load or reload.
Open for a cool algorithm to space them out...
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@36178 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 1856c9af2..07576269b 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2249,9 +2249,8 @@ static void sip_destroy_peer(struct sip_peer *peer) if (peer->call) sip_destroy(peer->call); - if (peer->mwipvt) { /* We have an active subscription, delete it */ + if (peer->mwipvt) /* We have an active subscription, delete it */ sip_destroy(peer->mwipvt); - } if (peer->chanvars) { ast_variables_destroy(peer->chanvars); @@ -16257,12 +16256,23 @@ static int sip_get_codec(struct ast_channel *chan) return p->peercapability; } -/*! \brief Send a poke to all known peers */ +/*! \brief Send a poke to all known peers + Space them out 100 ms apart + XXX We might have a cool algorithm for this or use random - any suggestions? +*/ static void sip_poke_all_peers(void) { + int ms = 0; + + if (!speerobjs) /* No peers, just give up */ + return; + ASTOBJ_CONTAINER_TRAVERSE(&peerl, 1, do { ASTOBJ_WRLOCK(iterator); - sip_poke_peer(iterator); + if (iterator->pokeexpire > -1) + ast_sched_del(sched, iterator->pokeexpire); + ms += 100; + iterator->pokeexpire = ast_sched_add(sched, ms, sip_poke_peer_s, iterator); ASTOBJ_UNLOCK(iterator); } while (0) ); |