[dovecot-cvs] dovecot/src/imap cmd-idle.c,1.30,1.30.2.1
cras at dovecot.org
cras at dovecot.org
Fri Aug 4 20:46:11 EEST 2006
Update of /var/lib/cvs/dovecot/src/imap
In directory talvi:/tmp/cvs-serv13653
Modified Files:
Tag: branch_1_0
cmd-idle.c
Log Message:
When mailbox changes are noticed and they're sent to client, cork before
doing it so each command isn't sent in a separate packet.
Index: cmd-idle.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/imap/cmd-idle.c,v
retrieving revision 1.30
retrieving revision 1.30.2.1
diff -u -d -r1.30 -r1.30.2.1
--- cmd-idle.c 6 Mar 2006 20:34:43 -0000 1.30
+++ cmd-idle.c 4 Aug 2006 17:46:09 -0000 1.30.2.1
@@ -22,6 +22,7 @@
struct timeout *idle_to, *keepalive_to;
uint32_t dummy_seq;
+ unsigned int manual_cork:1;
unsigned int idle_timeout:1;
unsigned int sync_pending:1;
};
@@ -161,8 +162,10 @@
if (ctx->sync_ctx != NULL)
ctx->sync_pending = TRUE;
- else
- idle_sync_now(box, ctx);
+ else {
+ ctx->manual_cork = TRUE;
+ idle_sync_now(box, ctx);
+ }
}
static bool cmd_idle_continue(struct client_command_context *cmd)
@@ -175,9 +178,19 @@
return TRUE;
}
+ if (ctx->manual_cork) {
+ /* we're coming from idle_callback instead of a normal
+ I/O handler, so we'll have to do corking manually */
+ o_stream_cork(client->output);
+ }
+
if (ctx->sync_ctx != NULL) {
if (imap_sync_more(ctx->sync_ctx) == 0) {
/* unfinished */
+ if (ctx->manual_cork) {
+ ctx->manual_cork = FALSE;
+ o_stream_uncork(client->output);
+ }
return FALSE;
}
@@ -199,6 +212,11 @@
}
client->output_pending = FALSE;
+ if (ctx->manual_cork) {
+ ctx->manual_cork = FALSE;
+ o_stream_uncork(client->output);
+ }
+
if (client->io == NULL) {
/* input is pending */
client->io = io_add(i_stream_get_fd(client->input),
More information about the dovecot-cvs
mailing list