[asterisk-commits] murf: branch murf/bug11210 r102714 - in /team/murf/bug11210: channels/ includ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 6 11:01:30 CST 2008


Author: murf
Date: Wed Feb  6 11:01:29 2008
New Revision: 102714

URL: http://svn.digium.com/view/asterisk?view=rev&rev=102714
Log:
Good. The problem with the peer code was that unscheduling code was duplicated via the update to the SCHED_DEL form. Got that fixed. There's a little bug in the SCHED_DEL macro, which I fixed. I also included code to notify of delete waits, which are apparently very rare.

Modified:
    team/murf/bug11210/channels/chan_sip.c
    team/murf/bug11210/include/asterisk/sched.h

Modified: team/murf/bug11210/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/channels/chan_sip.c?view=diff&rev=102714&r1=102713&r2=102714
==============================================================================
--- team/murf/bug11210/channels/chan_sip.c (original)
+++ team/murf/bug11210/channels/chan_sip.c Wed Feb  6 11:01:29 2008
@@ -3589,19 +3589,6 @@
 		ast_variables_destroy(peer->chanvars);
 		peer->chanvars = NULL;
 	}
-	if (peer->expire > -1) {
-		int ret = ast_sched_del(sched, peer->expire); /* HUH?  normally, if peer were being refcounted thru sched calls, we'd
-														 add code after this to unref the peer */
-		if (ret == 0)  /* if it succeeds, we can wipe out the entry */
-			peer->expire = -1;
-		
-	}
-	if (peer->pokeexpire > -1) {
-		int ret = ast_sched_del(sched, peer->pokeexpire); /* HUH?  normally, if peer were being refcounted thru sched calls, we'd
-											   add code after this to unref the peer */
-		if (ret == 0)  /* if it succeeds, we can wipe out the entry */
-			peer->expire = -1;
-	}
 	
 	/* If the schedule delete fails, that means the schedule is currently
 	 * running, which means we should wait for that thread to complete.
@@ -3609,8 +3596,8 @@
 	 *
 	 * NOTE: once peer is refcounted, this probably is no longer necessary.
 	 */
-	AST_SCHED_DEL(sched, peer->expire);
-	AST_SCHED_DEL(sched, peer->pokeexpire);
+	AST_SCHED_DEL(sched, peer->expire);  /* HUH? At some future time, if we need to refcount peers.... */
+	AST_SCHED_DEL(sched, peer->pokeexpire);  /* HUH? At some future time, if we need to refcount peers.... */
 
 	register_peer_exten(peer, FALSE);
 	ast_free_ha(peer->ha);

Modified: team/murf/bug11210/include/asterisk/sched.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug11210/include/asterisk/sched.h?view=diff&rev=102714&r1=102713&r2=102714
==============================================================================
--- team/murf/bug11210/include/asterisk/sched.h (original)
+++ team/murf/bug11210/include/asterisk/sched.h Wed Feb  6 11:01:29 2008
@@ -39,20 +39,24 @@
 #define AST_SCHED_DEL(sched, id) \
 	do { \
 		int _count = 0; \
-		while (id > -1 && ast_sched_del(sched, id) && _count++ < 10) \
+		while (id > -1 && ast_sched_del(sched, id) && ++_count < 10) \
 			usleep(1); \
 		if (_count == 10) \
 			ast_log(LOG_WARNING, "Unable to cancel schedule ID %d.  This is probably a bug (%s: %s, line %d).\n", id, __FILE__, __PRETTY_FUNCTION__, __LINE__); \
+		if (_count && _count != 10) \
+			ast_log(LOG_WARNING, "It took %d loops to delete schedule entry %d (%s: %s, line %d).\n", _count, id,  __FILE__, __PRETTY_FUNCTION__, __LINE__); \
 		id = -1; \
 	} while (0);
 
 #define AST_SCHED_DEL_UNREF(sched, id, refcall)			\
 	do { \
 		int _count = 0; \
-		while (id > -1 && ast_sched_del(sched, id) && _count++ < 10) \
+		while (id > -1 && ast_sched_del(sched, id) && ++_count < 10) \
 			usleep(1); \
 		if (_count == 10) \
 			ast_log(LOG_WARNING, "Unable to cancel schedule ID %d.  This is probably a bug (%s: %s, line %d).\n", id, __FILE__, __PRETTY_FUNCTION__, __LINE__); \
+		if (_count && _count != 10) \
+			ast_log(LOG_WARNING, "It took %d loops to delete schedule entry %d (%s: %s, line %d).\n", _count, id,  __FILE__, __PRETTY_FUNCTION__, __LINE__); \
 		if (id > -1) \
 			refcall; \
 		id = -1; \




More information about the asterisk-commits mailing list