[asterisk-commits] trunk r36178 - /trunk/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jun 27 11:00:09 MST 2006


Author: oej
Date: Tue Jun 27 13:00:09 2006
New Revision: 36178

URL: http://svn.digium.com/view/asterisk?rev=36178&view=rev
Log:
issue #7033 - Don't burst pokes to peers at load or reload.
Open for a cool algorithm to space them out...

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=36178&r1=36177&r2=36178&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Jun 27 13:00:09 2006
@@ -2249,9 +2249,8 @@
 	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 @@
 	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)
 	);



More information about the asterisk-commits mailing list