[asterisk-commits] russell: branch 1.4 r140060 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 26 11:07:59 CDT 2008


Author: russell
Date: Tue Aug 26 11:07:58 2008
New Revision: 140060

URL: http://svn.digium.com/view/asterisk?view=rev&rev=140060
Log:
Fix some bogus scheduler usage in chan_sip.  This code used the return value
of a completely unrelated function to determine whether the scheduler should
be run or not.  This would have caused the scheduler to not run in cases where
it should have.  Also, leave a note about another scheduler issue that needs
to be addressed at some point.

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=140060&r1=140059&r2=140060
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Tue Aug 26 11:07:58 2008
@@ -16101,6 +16101,12 @@
 		}
 		ast_mutex_unlock(&iflock);
 
+		/* XXX TODO The scheduler usage in this module does not have sufficient 
+		 * synchronization being done between running the scheduler and places 
+		 * scheduling tasks.  As it is written, any scheduled item may not run 
+		 * any sooner than about  1 second, regardless of whether a sooner time 
+		 * was asked for. */
+
 		pthread_testcancel();
 		/* Wait for sched or io */
 		res = ast_sched_wait(sched);
@@ -16113,11 +16119,9 @@
 		if (option_debug && res > 20)
 			ast_log(LOG_DEBUG, "chan_sip: ast_io_wait ran %d all at once\n", res);
 		ast_mutex_lock(&monlock);
-		if (res >= 0)  {
-			res = ast_sched_runq(sched);
-			if (option_debug && res >= 20)
-				ast_log(LOG_DEBUG, "chan_sip: ast_sched_runq ran %d all at once\n", res);
-		}
+		res = ast_sched_runq(sched);
+		if (option_debug && res >= 20)
+			ast_log(LOG_DEBUG, "chan_sip: ast_sched_runq ran %d all at once\n", res);
 
 		/* Send MWI notifications to peers - static and cached realtime peers */
 		t = time(NULL);




More information about the asterisk-commits mailing list