changeset 21868:84ab6a7f172f

imap: Fix assert-crash when hibernation triggers during IDLE syncing Fixes: Panic: file cmd-idle.c: line 182 (idle_hibernate_timeout): assertion failed: (ctx->sync_ctx == NULL)
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Fri, 31 Mar 2017 01:02:49 +0300
parents a5de42736743
children af53beea365a
files src/imap/cmd-idle.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-idle.c	Mon Mar 27 11:02:31 2017 +0300
+++ b/src/imap/cmd-idle.c	Fri Mar 31 01:02:49 2017 +0300
@@ -140,6 +140,12 @@
 {
 	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);