--- a/libpurple/protocols/jabber/jabber.c Mon Apr 13 03:07:41 2020 -0400
+++ b/libpurple/protocols/jabber/jabber.c Sun Apr 26 18:51:58 2020 -0400
@@ -606,11 +606,23 @@
PURPLE_ASSERT_CONNECTION_IS_VALID(gc);
- len = g_pollable_input_stream_read_nonblocking(
- G_POLLABLE_INPUT_STREAM(stream), buf, sizeof(buf) - 1,
- js->cancellable, &error);
+ len = g_pollable_input_stream_read_nonblocking( + G_POLLABLE_INPUT_STREAM(stream), buf, sizeof(buf) - 1, + js->cancellable, &error); + if (error->code == G_IO_ERROR_WOULD_BLOCK) { + return G_SOURCE_CONTINUE; + } else if (error->code == G_IO_ERROR_CANCELLED) { + g_prefix_error(&error, "%s", + _("Lost connection with server: ")); + purple_connection_g_error(js->gc, error); + return G_SOURCE_REMOVE; purple_connection_update_last_received(gc);
if (js->sasl_maxbuf > 0) {
@@ -644,16 +656,8 @@
jabber_parser_process(js, buf, len);
- len = g_pollable_input_stream_read_nonblocking(
- G_POLLABLE_INPUT_STREAM(stream), buf, sizeof(buf) - 1,
- js->cancellable, &error);
- if (error->code != G_IO_ERROR_WOULD_BLOCK &&
- error->code != G_IO_ERROR_CANCELLED) {
- g_prefix_error(&error, "%s", _("Lost connection with server: "));
- purple_connection_g_error(js->gc, error);
return G_SOURCE_CONTINUE;