dovecot-2.2: imap: When disconnected during FETCH, include the l...

dovecot at dovecot.org dovecot at dovecot.org
Wed Nov 18 10:41:09 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/b638e19d3bd4
changeset: 19387:b638e19d3bd4
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Nov 18 12:39:13 2015 +0200
description:
imap: When disconnected during FETCH, include the last byte counts in disconnection log message.

diffstat:

 src/imap/cmd-fetch.c   |  10 ++++++++--
 src/imap/imap-client.c |   2 +-
 2 files changed, 9 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r f8dcf8b91282 -r b638e19d3bd4 src/imap/cmd-fetch.c
--- a/src/imap/cmd-fetch.c	Tue Nov 17 19:02:13 2015 +0200
+++ b/src/imap/cmd-fetch.c	Wed Nov 18 12:39:13 2015 +0200
@@ -192,8 +192,14 @@
 		const char *errstr;
 
 		if (cmd->client->output->closed) {
-			client_disconnect(cmd->client, NULL);
-			return TRUE;
+			/* If we're canceling we need to finish this command
+			   or we'll assert crash. But normally we want to
+			   return FALSE so that the disconnect message logs
+			   about this fetch command and that these latest
+			   output bytes are included in it (which wouldn't
+			   happen if we called client_disconnect() here
+			   directly). */
+			return cmd->cancel;
 		}
 
 		errstr = mailbox_get_last_error(cmd->client->mailbox, &error);
diff -r f8dcf8b91282 -r b638e19d3bd4 src/imap/imap-client.c
--- a/src/imap/imap-client.c	Tue Nov 17 19:02:13 2015 +0200
+++ b/src/imap/imap-client.c	Wed Nov 18 12:39:13 2015 +0200
@@ -1135,7 +1135,7 @@
 
 	o_stream_uncork(client->output);
 	imap_refresh_proctitle();
-	if (client->disconnected)
+	if (client->output->closed)
 		client_destroy(client, NULL);
 	else
 		client_continue_pending_input(client);


More information about the dovecot-cvs mailing list