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

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


details:   http://hg.dovecot.org/dovecot-1.0/rev/a732e4d09ea3
changeset: 5385:a732e4d09ea3
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 24 19:26:23 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 33690bb286af -r a732e4d09ea3 src/imap/client.c
--- a/src/imap/client.c	Tue Aug 14 22:46:30 2007 +0300
+++ b/src/imap/client.c	Fri Aug 24 19:26:23 2007 +0300
@@ -60,6 +60,15 @@ struct client *client_create(int fd_in, 
 	return client;
 }
 
+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)
 {
 	int ret;
@@ -71,7 +80,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", reason);
 	}
 


More information about the dovecot-cvs mailing list