[asterisk-commits] russell: branch 1.4 r207360 - /branches/1.4/main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 20 11:27:05 CDT 2009


Author: russell
Date: Mon Jul 20 11:26:24 2009
New Revision: 207360

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=207360
Log:
Only do the chan->fdno check in ast_read() in a developer build.

I changed this check to only happen in a dev-mode build.  I also added a
comment explaining what is going on.  I also made it so that detection of
this situation does not affect ast_read() operation.

(closes issue #14723)
Reported by: seadweller

Modified:
    branches/1.4/main/channel.c

Modified: branches/1.4/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/main/channel.c?view=diff&rev=207360&r1=207359&r2=207360
==============================================================================
--- branches/1.4/main/channel.c (original)
+++ branches/1.4/main/channel.c Mon Jul 20 11:26:24 2009
@@ -2080,17 +2080,20 @@
 		goto done;
 	}
 
+#ifdef AST_DEVMODE
+	/* 
+	 * The ast_waitfor() code records which of the channel's file descriptors reported that
+	 * data is available.  In theory, ast_read() should only be called after ast_waitfor()
+	 * reports that a channel has data available for reading.  However, there still may be
+	 * some edge cases throughout the code where ast_read() is called improperly.  This can
+	 * potentially cause problems, so if this is a developer build, make a lot of noise if
+	 * this happens so that it can be addressed. 
+	 */
 	if (chan->fdno == -1) {
-#ifdef AST_DEVMODE
 		ast_log(LOG_ERROR, "ast_read() called with no recorded file descriptor.\n");
-#else
-		if (option_debug > 1) {
-			ast_log(LOG_DEBUG, "ast_read() called with no recorded file descriptor.\n");
-		}
+	}
 #endif
-		f = &ast_null_frame;
-		goto done;
-	}
+
 	prestate = chan->_state;
 
 	/* Read and ignore anything on the alertpipe, but read only




More information about the asterisk-commits mailing list