From: Timo Sirainen Date: Mon, 31 May 2010 18:28:04 +0000 (+0100) Subject: imap: Fixed previous idle change more correctly. X-Git-Tag: 2.0.beta6~93 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ee1dfe238d74e970f8b890f453ca118d51b1cc81;p=thirdparty%2Fdovecot%2Fcore.git imap: Fixed previous idle change more correctly. The previous way could have crashed in some situations. --HG-- branch : HEAD --- diff --git a/src/imap/cmd-idle.c b/src/imap/cmd-idle.c index f6397bf718..738ea63b79 100644 --- a/src/imap/cmd-idle.c +++ b/src/imap/cmd-idle.c @@ -127,11 +127,15 @@ static void idle_sync_now(struct mailbox *box, struct cmd_idle_context *ctx) static void idle_callback(struct mailbox *box, struct cmd_idle_context *ctx) { + struct client *client = ctx->client; + if (ctx->sync_ctx != NULL) ctx->sync_pending = TRUE; else { ctx->manual_cork = TRUE; idle_sync_now(box, ctx); + if (client->disconnected) + client_destroy(client, NULL); } } @@ -207,7 +211,6 @@ static bool cmd_idle_continue(struct client_command_context *cmd) if (client->output->closed) { idle_finish(ctx, FALSE, FALSE); - client_destroy(client, NULL); return TRUE; } if (client->io == NULL) {