dovecot: If read/write to client failed with some error, log it.

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 24 19:26:27 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/f8c9b1a93521
changeset: 6309:f8c9b1a93521
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 24 19:26:22 2007 +0300
description:
If read/write to client failed with some error, log it.

diffstat:

1 file changed, 10 insertions(+), 1 deletion(-)
src/imap/client.c |   11 ++++++++++-

diffs (28 lines):

diff -r b44b090d7c07 -r f8c9b1a93521 src/imap/client.c
--- a/src/imap/client.c	Wed Aug 22 16:24:30 2007 +0300
+++ b/src/imap/client.c	Fri Aug 24 19:26:22 2007 +0300
@@ -91,6 +91,15 @@ static const char *client_stats(struct c
 	return str_c(str);
 }
 
+static const char *client_get_disconnect_reason(struct client *client)
+{
+	errno = client->input->stream_errno != 0 ?
+		client->input->stream_errno :
+		client->output->stream_errno;
+	return errno == 0 ? "Disconnected" :
+		t_strdup_printf("Disconnected: %m");
+}
+
 void client_destroy(struct client *client, const char *reason)
 {
 	i_assert(!client->destroyed);
@@ -99,7 +108,7 @@ void client_destroy(struct client *clien
 	if (!client->disconnected) {
 		client->disconnected = TRUE;
 		if (reason == NULL)
-			reason = "Disconnected";
+			reason = client_get_disconnect_reason(client);
 		i_info("%s %s", reason, client_stats(client));
 	}
 


More information about the dovecot-cvs mailing list