commit e664b676602274aa7e7056444de88fa8f5684185
parent f38cf9f13e82e0c1012286573ad96511f2d868c1
Author: Colin Leroy <colin@colino.net>
Date: Mon, 21 Apr 2014 13:49:46 +0200
Fix bug #3139, "Mainwindow unresponsive due to a busy loop"
In case of unexpected return from gnutls_record_recv(), set errno to
a fatal error.
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/common/session.c b/src/common/session.c
@@ -528,9 +528,10 @@ static gboolean session_read_msg_cb(SockInfo *source, GIOCondition condition,
session_set_timeout(session, session->timeout_interval);
if (session->read_buf_len == 0) {
- gint read_len;
+ gint read_len = -1;
- read_len = sock_read(session->sock, session->read_buf,
+ if (session->sock)
+ read_len = sock_read(session->sock, session->read_buf,
SESSION_BUFFSIZE - 1);
if (read_len == -1 && session->state == SESSION_DISCONNECTED) {
diff --git a/src/common/socket.c b/src/common/socket.c
@@ -1417,6 +1417,8 @@ static gint ssl_read(gnutls_session_t ssl, gchar *buf, gint len)
return -1;
default:
+ debug_print("Unexpected SSL read result %d\n", r);
+ errno = EIO;
return -1;
}
}