[asterisk-commits] russell: trunk r79858 - in /trunk: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 17 08:39:17 CDT 2007


Author: russell
Date: Fri Aug 17 08:39:17 2007
New Revision: 79858

URL: http://svn.digium.com/view/asterisk?view=rev&rev=79858
Log:
Merged revisions 79857 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r79857 | russell | 2007-08-17 08:37:08 -0500 (Fri, 17 Aug 2007) | 5 lines

Fix some crashes in chan_sip.  This patch changes various places that add items
to the scheduler to ensure that they don't overwrite the ID of a previously
scheduled item.  If there is one, it should be removed.
(closes issue #10391, closes issue #10256, probably others, patch by me)

........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=79858&r1=79857&r2=79858
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Aug 17 08:39:17 2007
@@ -2373,6 +2373,8 @@
 		siptimer_a = pkt->timer_t1 * 2;
 
 	/* Schedule retransmission */
+	if (pkt->retransid > -1)
+		ast_sched_del(sched, pkt->retransid);
 	pkt->retransid = ast_sched_add_variable(sched, siptimer_a, retrans_pkt, pkt, 1);
 	if (sipdebug)
 		ast_debug(4, "*** SIP TIMER: Initalizing retransmit timer on packet: Id  #%d\n", pkt->retransid);
@@ -3561,6 +3563,8 @@
 		p->invitestate = INV_CALLING;
 	
 		/* Initialize auto-congest time */
+		if (p->initid > -1)
+			ast_sched_del(sched, p->initid);
 		p->initid = ast_sched_add(sched, SIP_TRANS_TIMEOUT, auto_congest, dialog_ref(p));
 	}
 
@@ -13439,7 +13443,9 @@
 		r->refresh= (int) expires_ms / 1000;
 
 		/* Schedule re-registration before we expire */
-		r->expire=ast_sched_add(sched, expires_ms, sip_reregister, r); 
+		if (r->expire > -1)
+			ast_sched_del(sched, r->expire);
+		r->expire = ast_sched_add(sched, expires_ms, sip_reregister, r); 
 		registry_unref(r);
 	}
 	return 1;
@@ -16564,6 +16570,8 @@
 	peer->lastms = -1;
 	ast_device_state_changed("SIP/%s", peer->name);
 	/* Try again quickly */
+	if (peer->pokeexpire > -1)
+		ast_sched_del(sched, peer->pokeexpire);
 	peer->pokeexpire = ast_sched_add(sched, DEFAULT_FREQ_NOTOK, sip_poke_peer_s, peer);
 	return 0;
 }
@@ -16626,8 +16634,11 @@
 	peer->ps = ast_tvnow();
 	if (xmitres == XMIT_ERROR)
 		sip_poke_noanswer(peer);	/* Immediately unreachable, network problems */
-	else
+	else {
+		if (peer->pokeexpire > -1)
+			ast_sched_del(sched, peer->pokeexpire);
 		peer->pokeexpire = ast_sched_add(sched, DEFAULT_MAXMS * 2, sip_poke_noanswer, peer);
+	}
 
 	return 0;
 }




More information about the asterisk-commits mailing list