]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Fix assert-crash when hibernation triggers during IDLE syncing
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 30 Mar 2017 22:02:49 +0000 (01:02 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 3 Apr 2017 11:00:04 +0000 (14:00 +0300)
Fixes:
Panic: file cmd-idle.c: line 182 (idle_hibernate_timeout): assertion failed: (ctx->sync_ctx == NULL)

src/imap/cmd-idle.c

index 8e3ae6431989f161893623d6eda3fac2b5a1b3f6..330222878fa0342d517271a1d11cdf0ff485a9c1 100644 (file)
@@ -140,6 +140,12 @@ static bool idle_sync_now(struct mailbox *box, struct cmd_idle_context *ctx)
 {
        i_assert(ctx->sync_ctx == NULL);
 
+       if (ctx->to_hibernate != NULL) {
+               /* hibernation can't happen while sync is running.
+                  the timeout is added back afterwards. */
+               timeout_remove(&ctx->to_hibernate);
+       }
+
        ctx->sync_pending = FALSE;
        ctx->sync_ctx = imap_sync_init(ctx->client, box, 0, 0);
        return cmd_idle_continue(ctx->cmd);