changeset 4830:a642d3df700f HEAD

If syncing finished with an error and client had disconnected, we assert-crashed in io_add().
author Timo Sirainen <tss@iki.fi>
date Sat, 18 Nov 2006 23:29:58 +0200
parents 830cb3af6623
children 7e50162a378c
files src/imap/cmd-idle.c
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/imap/cmd-idle.c	Sat Nov 18 23:09:49 2006 +0200
+++ b/src/imap/cmd-idle.c	Sat Nov 18 23:29:58 2006 +0200
@@ -170,11 +170,6 @@
 	struct client *client = cmd->client;
 	struct cmd_idle_context *ctx = cmd->context;
 
-	if (client->output->closed) {
-		idle_finish(ctx, FALSE);
-		return TRUE;
-	}
-
 	if (ctx->sync_ctx != NULL) {
 		if (imap_sync_more(ctx->sync_ctx) == 0) {
 			/* unfinished */
@@ -202,6 +197,10 @@
 	}
         client->output_pending = FALSE;
 
+	if (client->output->closed) {
+		idle_finish(ctx, FALSE);
+		return TRUE;
+	}
 	if (client->io == NULL) {
 		/* input is pending */
 		client->io = io_add(i_stream_get_fd(client->input),