comparison libgaim/protocols/novell/nmuser.c @ 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 60b1bc8dbf37
children 897d2d09787e
comparison
equal deleted inserted replaced
14593:d24de94469f4 14594:78f121689460
995 NMERR_T 995 NMERR_T
996 nm_process_new_data(NMUser * user) 996 nm_process_new_data(NMUser * user)
997 { 997 {
998 NMConn *conn; 998 NMConn *conn;
999 NMERR_T rc = NM_OK; 999 NMERR_T rc = NM_OK;
1000 int ret;
1001 guint32 val; 1000 guint32 val;
1002 1001
1003 if (user == NULL) 1002 if (user == NULL)
1004 return NMERR_BAD_PARM; 1003 return NMERR_BAD_PARM;
1005 1004
1006 conn = user->conn; 1005 conn = user->conn;
1007 1006
1008 /* Check to see if this is an event or a response */ 1007 /* Check to see if this is an event or a response */
1009 ret = nm_tcp_read(conn, (char *) &val, sizeof(val)); 1008 rc = nm_read_all(conn, (char *) &val, sizeof(val));
1010 if (ret == sizeof(val)) { 1009 if (rc == NM_OK) {
1011
1012 if (strncmp((char *) &val, "HTTP", strlen("HTTP")) == 0) 1010 if (strncmp((char *) &val, "HTTP", strlen("HTTP")) == 0)
1013 rc = nm_process_response(user); 1011 rc = nm_process_response(user);
1014 else 1012 else
1015 rc = nm_process_event(user, GUINT32_FROM_LE(val)); 1013 rc = nm_process_event(user, GUINT32_FROM_LE(val));
1016 1014
1017 } else { 1015 } else {
1018 rc = NMERR_PROTOCOL; 1016 if (errno == EAGAIN)
1017 rc = NM_OK;
1018 else
1019 rc = NMERR_PROTOCOL;
1019 } 1020 }
1020 1021
1021 return rc; 1022 return rc;
1022 } 1023 }
1023 1024