[asterisk-commits] russell: branch 1.2 r59357 - /branches/1.2/rtp.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Mar 29 10:14:33 MST 2007


Author: russell
Date: Thu Mar 29 12:14:33 2007
New Revision: 59357

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59357
Log:
If an error occurs when reading from an RTP socket, and the error code does not
indicate that we should try again, then return NULL instead of a "null frame".
This will prevent Asterisk from trying over and over again, and eventually
causing the system to crash.  (issue #8285, john)

Modified:
    branches/1.2/rtp.c

Modified: branches/1.2/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/rtp.c?view=diff&rev=59357&r1=59356&r2=59357
==============================================================================
--- branches/1.2/rtp.c (original)
+++ branches/1.2/rtp.c Thu Mar 29 12:14:33 2007
@@ -386,10 +386,12 @@
 					0, (struct sockaddr *)&sin, &len);
 	
 	if (res < 0) {
-		if (errno != EAGAIN)
-			ast_log(LOG_WARNING, "RTP Read error: %s\n", strerror(errno));
 		if (errno == EBADF)
 			CRASH;
+		if (errno != EAGAIN) {
+			ast_log(LOG_WARNING, "RTP Read error: %s.  Hanging up now.\n", strerror(errno));
+			return NULL;
+		}
 		return &null_frame;
 	}
 
@@ -453,10 +455,12 @@
 
 	rtpheader = (unsigned int *)(rtp->rawdata + AST_FRIENDLY_OFFSET);
 	if (res < 0) {
-		if (errno != EAGAIN)
-			ast_log(LOG_WARNING, "RTP Read error: %s\n", strerror(errno));
 		if (errno == EBADF)
 			CRASH;
+		if (errno != EAGAIN) {
+			ast_log(LOG_WARNING, "RTP Read error: %s.  Hanging up now.\n", strerror(errno));
+			return NULL;
+		}
 		return &null_frame;
 	}
 	if (res < hdrlen) {



More information about the asterisk-commits mailing list