changeset 23563:186af522f14d

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.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Wed, 09 Jul 2008 04:39:02 +0000
parents 7f4473544c64
children 7bceac816e19
files libpurple/protocols/msn/servconn.c
diffstat 1 files changed, 9 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- 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';