[svn-commits] mnicholson: trunk r927 - /trunk/channels/chan_mobile.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed May 27 12:13:49 CDT 2009


Author: mnicholson
Date: Wed May 27 12:13:44 2009
New Revision: 927

URL: http://svn.asterisk.org/svn-view/asterisk-addons?view=rev&rev=927
Log:
Handle read errors from the sco_socket by closing the socket conenction and waiting for another one before reading again.  This is non standard behavior to accomidate certain Nokia handsets.

(closes issue #15075)
Reported by: hmld
Patches:
      chan_mobile_v2.diff uploaded by zvision (license 798)
      chan_mobile_v2a.diff uploaded by hmld (license 777)
Tested by: hmld, zvision, rseste

Modified:
    trunk/channels/chan_mobile.c

Modified: trunk/channels/chan_mobile.c
URL: http://svn.asterisk.org/svn-view/asterisk-addons/trunk/channels/chan_mobile.c?view=diff&rev=927&r1=926&r2=927
==============================================================================
--- trunk/channels/chan_mobile.c (original)
+++ trunk/channels/chan_mobile.c Wed May 27 12:13:44 2009
@@ -1026,9 +1026,10 @@
 		CHANNEL_DEADLOCK_AVOIDANCE(ast);
 	}
 
-	if (!pvt->owner) {
+	if (!pvt->owner || pvt->sco_socket == -1) {
 		goto e_return;
 	}
+
 	memset(&pvt->fr, 0x00, sizeof(struct ast_frame));
 	pvt->fr.frametype = AST_FRAME_VOICE;
 	pvt->fr.subclass = DEVICE_FRAME_FORMAT;
@@ -1040,7 +1041,12 @@
 	pvt->fr.data.ptr = pvt->io_buf + AST_FRIENDLY_OFFSET;
 
 	if ((r = read(pvt->sco_socket, pvt->fr.data.ptr, DEVICE_FRAME_SIZE)) == -1) {
-		ast_log(LOG_ERROR, "read error %d\n", errno);
+		if (errno != EAGAIN && errno != EINTR) {
+			ast_debug(1, "[%s] read error %d, going to wait for new connection\n", pvt->id, errno);
+			close(pvt->sco_socket);
+			pvt->sco_socket = -1;
+			ast_channel_set_fd(ast, 0, -1);
+		}
 		goto e_return;
 	}
 




More information about the svn-commits mailing list