In MSN servconn, make handling of EAGAIN similar to that in httpconn. cpw.qulogic.msn

Wed, 09 Jul 2008 04:39:02 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Wed, 09 Jul 2008 04:39:02 +0000
branch
cpw.qulogic.msn
changeset 23829
b6b23770413e
parent 23828
435f787db3f8
child 23830
1436e3de5d6c

In MSN servconn, make handling of EAGAIN similar to that in httpconn.
Now it should report an error when the server blocks some text and then
disconnects, instead of continuously trying to read something and
seeming totally frozen.

Also, stopped checking for EBADF, since it's not checked in httpconn.c
or soap.c. I hope that doesn't break anything.

References #6257.

libpurple/protocols/msn/servconn.c file | annotate | diff | comparison | revisions
--- a/libpurple/protocols/msn/servconn.c	Wed Jul 09 04:18:07 2008 +0000
+++ b/libpurple/protocols/msn/servconn.c	Wed Jul 09 04:39:02 2008 +0000
@@ -393,21 +393,16 @@
 	len = read(servconn->fd, buf, sizeof(buf) - 1);
 	servconn->session->account->gc->last_received = time(NULL);
 
-	if (len <= 0) {
-		switch (errno) {
-
-			case 0:
-
-			case EBADF:
-			case EAGAIN: return;
+	if (len < 0 && errno == EAGAIN) {
+		return;
 
-			default: purple_debug_error("msn", "servconn read error,"
-						"len: %d, errno: %d, error: %s\n",
-						len, errno, g_strerror(errno));
-				 msn_servconn_got_error(servconn,
-						 MSN_SERVCONN_ERROR_READ);
-				 return;
-		}
+	} else if (len <= 0) {
+		purple_debug_error("msn", "servconn read error,"
+		                          "len: %d, errno: %d, error: %s\n",
+		                          len, errno, g_strerror(errno));
+		msn_servconn_got_error(servconn, MSN_SERVCONN_ERROR_READ);
+
+		return;
 	}
 
 	buf[len] = '\0';

mercurial