changeset 13789:8e5c9f3ca158

imapc: If remote server disconnects, log the reason.
author Timo Sirainen <tss@iki.fi>
date Thu, 01 Dec 2011 09:24:58 +0200
parents e99c65be76f7
children 6591f7783d55
files src/lib-imap-client/imapc-connection.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-imap-client/imapc-connection.c	Thu Dec 01 09:15:53 2011 +0200
+++ b/src/lib-imap-client/imapc-connection.c	Thu Dec 01 09:24:58 2011 +0200
@@ -1108,8 +1108,12 @@
 				conn->name);
 		} else if (!conn->handshake_failed) {
 			errstr = ssl_iostream_get_last_error(conn->ssl_iostream);
+			if (errstr == NULL) {
+				errstr = conn->input->stream_errno == 0 ? "EOF" :
+					strerror(conn->input->stream_errno);
+			}
 			i_error("imapc(%s): Server disconnected: %s",
-				conn->name, errstr != NULL ? errstr : "");
+				conn->name, errstr);
 		}
 		imapc_connection_reconnect(conn);
 	}