]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
If remote disconnects, log "Connection closed: reason" just like IMAP does.
authorTimo Sirainen <tss@iki.fi>
Thu, 24 Apr 2008 12:48:01 +0000 (15:48 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 24 Apr 2008 12:48:01 +0000 (15:48 +0300)
--HG--
branch : HEAD

src/pop3/client.c

index f82f4498aefdc359dacbbf1e0acb22390a4e20ca..b2724f8adac2757d102b6777d98d87645f40fe70 100644 (file)
@@ -239,11 +239,20 @@ static const char *client_stats(struct client *client)
        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));
        }