changeset 14594:78f121689460

[gaim-migrate @ 17319] Rest of SF Patch #1559532 from Mike Stoddard Fixes SF Bug 1520965 Fixes SF Bug 1544012 "This is patch to fix connection problems in the Novell protocol plugin. It should fix bugs 1520965 and 1544012." "The two bugs are both connection problems. Unfortunately the plugin is designed to be a little too synchronous so non-blocking i/o causes problems for it. The fix is to retry a little longer in nm_read_all and to not disconnect if errno is EAGAIN after processing an incoming response or event. When I get more time I will work on making the plugin more asynchronous so that we don't have to block in nm_read_all. For now however this patch will get people working again. Any suggestions/comments are welcome." I consulted with Daniel on this one, and I'm committing it as a temporary fix, since Mike says he's going to fix it for real later. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Tue, 19 Sep 2006 01:01:20 +0000
parents d24de94469f4
children 209e187246c5
files libgaim/protocols/novell/nmconn.c libgaim/protocols/novell/nmuser.c
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/protocols/novell/nmconn.c	Tue Sep 19 00:55:20 2006 +0000
+++ b/libgaim/protocols/novell/nmconn.c	Tue Sep 19 01:01:20 2006 +0000
@@ -232,7 +232,7 @@
 	int bytes_left = len;
 	int bytes_read;
 	int total_bytes = 0;
-	int retry = 10;
+	int retry = 1000;
 
 	if (conn == NULL || buff == NULL)
 		return NMERR_BAD_PARM;
@@ -250,7 +250,7 @@
 					break;
 				}
 #ifdef _WIN32
-				Sleep(1000);
+				Sleep(1);
 #else
 				usleep(1000);
 #endif
--- a/libgaim/protocols/novell/nmuser.c	Tue Sep 19 00:55:20 2006 +0000
+++ b/libgaim/protocols/novell/nmuser.c	Tue Sep 19 01:01:20 2006 +0000
@@ -997,7 +997,6 @@
 {
 	NMConn *conn;
 	NMERR_T rc = NM_OK;
-	int ret;
 	guint32 val;
 
 	if (user == NULL)
@@ -1006,16 +1005,18 @@
 	conn = user->conn;
 
 	/* Check to see if this is an event or a response */
-	ret = nm_tcp_read(conn, (char *) &val, sizeof(val));
-	if (ret == sizeof(val)) {
-
+	rc = nm_read_all(conn, (char *) &val, sizeof(val));
+	if (rc == NM_OK) {
 		if (strncmp((char *) &val, "HTTP", strlen("HTTP")) == 0)
 			rc = nm_process_response(user);
 		else
 			rc = nm_process_event(user, GUINT32_FROM_LE(val));
 
 	} else {
-		rc = NMERR_PROTOCOL;
+		if (errno == EAGAIN)
+			rc = NM_OK;
+		else
+			rc = NMERR_PROTOCOL;
 	}
 
 	return rc;