dovecot-1.1: If remote disconnects, log "Connection closed: reas...

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 24 15:48:09 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/3353ddd8ac9f
changeset: 7453:3353ddd8ac9f
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 24 15:48:01 2008 +0300
description:
If remote disconnects, log "Connection closed: reason" just like IMAP does.

diffstat:

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

diffs (25 lines):

diff -r 29518d8b5029 -r 3353ddd8ac9f src/pop3/client.c
--- a/src/pop3/client.c	Fri Apr 18 12:52:08 2008 +0300
+++ b/src/pop3/client.c	Thu Apr 24 15:48:01 2008 +0300
@@ -239,11 +239,20 @@ 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 || errno == EPIPE ? "Connection closed" :
+		t_strdup_printf("Connection closed: %m");
+}
+
 void client_destroy(struct client *client, const char *reason)
 {
 	if (!client->disconnected) {
 		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