# HG changeset patch # User Mark Doliner # Date 1214866698 0 # Node ID 47b709962aabcac92f5cef8ff97fa4d279c5edb0 # Parent 0119f73a76daf41a5424b610c16844940891c02a Only check for EAGAIN if read returned less than 0. This fixes a bug where the recv callback function would get called continuously if the server closed our connection and errno happened to be set to EAGAIN. diff -r 0119f73a76da -r 47b709962aab libpurple/protocols/jabber/jabber.c --- a/libpurple/protocols/jabber/jabber.c Sun Jun 29 01:51:59 2008 +0000 +++ b/libpurple/protocols/jabber/jabber.c Mon Jun 30 22:58:18 2008 +0000 @@ -430,12 +430,17 @@ jabber_stream_init(js); } - if(errno == EAGAIN) + if(len < 0 && errno == EAGAIN) return; - else + else { + if (len == 0) + purple_debug_info("jabber", "Server closed the connection.\n"); + else + purple_debug_info("jabber", "Disconnected: %s\n", g_strerror(errno)); purple_connection_error_reason (js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Read Error")); + } } static void @@ -470,9 +475,13 @@ jabber_parser_process(js, buf, len); if(js->reinit) jabber_stream_init(js); - } else if(errno == EAGAIN) { + } else if(len < 0 && errno == EAGAIN) { return; } else { + if (len == 0) + purple_debug_info("jabber", "Server closed the connection.\n"); + else + purple_debug_info("jabber", "Disconnected: %s\n", g_strerror(errno)); purple_connection_error_reason (js->gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Read Error"));