[dovecot-cvs] dovecot/src/imap cmd-idle.c,1.19,1.20

cras at dovecot.org cras at dovecot.org
Tue Dec 6 16:32:52 EET 2005


Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv29473

Modified Files:
	cmd-idle.c 
Log Message:
If DONE was sent while output was still being sent to clients, we didn't
deinitialize syncing properly. That output mustn't get lost anyway, so
now DONE isn't accepted until all output is sent.



Index: cmd-idle.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-idle.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- cmd-idle.c	7 Aug 2005 11:41:20 -0000	1.19
+++ cmd-idle.c	6 Dec 2005 14:32:50 -0000	1.20
@@ -34,6 +34,11 @@
 		ctx->to = NULL;
 	}
 
+	if (ctx->sync_ctx != NULL) {
+		/* we're here only in connection failure cases */
+		(void)imap_sync_deinit(ctx->sync_ctx);
+	}
+
 	o_stream_cork(client->output);
 
 	if (ctx->dummy_seq != 0) {
@@ -78,6 +83,14 @@
 		return;
 	}
 
+	if (ctx->sync_ctx != NULL) {
+		/* we're still sending output to client. wait until it's all
+		   sent so we don't lose any changes. */
+		io_remove(client->io);
+		client->io = NULL;
+		return;
+	}
+
 	while ((line = i_stream_next_line(client->input)) != NULL) {
 		if (client->input_skip_line)
 			client->input_skip_line = FALSE;
@@ -163,8 +176,14 @@
 		   client */
                 idle_callback(client->mailbox, client);
 	}
-
         client->output_pending = FALSE;
+
+	if (client->io == NULL) {
+		/* input is pending */
+		client->io = io_add(i_stream_get_fd(client->input),
+				    IO_READ, idle_client_input, ctx);
+		idle_client_input(ctx);
+	}
 	return FALSE;
 }
 



More information about the dovecot-cvs mailing list