dovecot-1.0: If remote disconnects, log "Connection closed: reas...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Apr 24 15:48:05 EEST 2008
details: http://hg.dovecot.org/dovecot-1.0/rev/e45d659a814b
changeset: 5546:e45d659a814b
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 cf92e479d9ae -r e45d659a814b src/pop3/client.c
--- a/src/pop3/client.c Sun Mar 30 11:57:56 2008 +0300
+++ b/src/pop3/client.c Thu Apr 24 15:48:01 2008 +0300
@@ -231,11 +231,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