[asterisk-commits] russell: trunk r38076 - in /trunk: autoservice.c include/asterisk/channel.h

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Jul 21 17:08:22 MST 2006


Author: russell
Date: Fri Jul 21 19:08:21 2006
New Revision: 38076

URL: http://svn.digium.com/view/asterisk?rev=38076&view=rev
Log:
remove an XXX comment and document that ast_autoservice_start() will return -1
if the channel is already in the autoservice list.

Why is this a valid case to return -1, you ask?  Well, there should never be
any code where it is not clear if the channel is in autoservice or not because
trying to read frames from a channel that is in the autoservice list will lead
to bad results because more than one thread will be waiting on frames to arrive
on the channel and then trying to read them.

Modified:
    trunk/autoservice.c
    trunk/include/asterisk/channel.h

Modified: trunk/autoservice.c
URL: http://svn.digium.com/view/asterisk/trunk/autoservice.c?rev=38076&r1=38075&r2=38076&view=diff
==============================================================================
--- trunk/autoservice.c (original)
+++ trunk/autoservice.c Fri Jul 21 19:08:21 2006
@@ -104,7 +104,6 @@
 		if (as->chan == chan)
 			break;
 	}
-	/* XXX if found, we return -1, why ??? */
 
 	/* If not, start autoservice on channel */
 	if (!as && (as = ast_calloc(1, sizeof(*as)))) {

Modified: trunk/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/channel.h?rev=38076&r1=38075&r2=38076&view=diff
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Fri Jul 21 19:08:21 2006
@@ -1060,10 +1060,20 @@
 /*! Play a tone pair for a given amount of time */
 int ast_tonepair(struct ast_channel *chan, int freq1, int freq2, int duration, int vol);
 
-/*! Automatically service a channel for us... */
+/*!
+ * \brief Automatically service a channel for us... 
+ *
+ * \retval 0 success
+ * \retval -1 failure, or the channel is already being autoserviced
+ */
 int ast_autoservice_start(struct ast_channel *chan);
 
-/*! Stop servicing a channel for us...  Returns -1 on error or if channel has been hungup */
+/*! 
+ * \brief Stop servicing a channel for us...  
+ *
+ * \retval 0 success
+ * \retval -1 error, or the channel has been hungup 
+ */
 int ast_autoservice_stop(struct ast_channel *chan);
 
 /* If built with zaptel optimizations, force a scheduled expiration on the



More information about the asterisk-commits mailing list