Skip to content

Commit

Permalink
imap: Fix assert-crash when hibernation triggers during IDLE syncing
Browse files Browse the repository at this point in the history
Fixes:
Panic: file cmd-idle.c: line 182 (idle_hibernate_timeout): assertion failed: (ctx->sync_ctx == NULL)
  • Loading branch information
sirainen committed Apr 3, 2017
1 parent bb8b63e commit 0545e6b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/imap/cmd-idle.c
Expand Up @@ -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);
Expand Down

0 comments on commit 0545e6b

Please sign in to comment.