Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7453:3353ddd8ac9f HEAD
If remote disconnects, log "Connection closed: reason" just like IMAP does.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 24 Apr 2008 15:48:01 +0300 |
parents | 29518d8b5029 |
children | 053ec63146cb |
files | src/pop3/client.c |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ 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)); }