From: Timo Sirainen Date: Thu, 14 Oct 2010 15:58:57 +0000 (+0100) Subject: imap, pop3: Cork TCP connection before trying to flush output in output callback. X-Git-Tag: 2.0.6~71 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=53d62bbb2dd9c356051611ae274917e04abd1692;p=thirdparty%2Fdovecot%2Fcore.git imap, pop3: Cork TCP connection before trying to flush output in output callback. --- diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index f4b88ce09f..95cd8e9cb3 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -847,6 +847,7 @@ int client_output(struct client *client) if (client->to_idle_output != NULL) timeout_reset(client->to_idle_output); + o_stream_cork(client->output); if ((ret = o_stream_flush(client->output)) < 0) { client_destroy(client, NULL); return 1; @@ -856,7 +857,6 @@ int client_output(struct client *client) for (cmd = client->command_queue; cmd != NULL; cmd = cmd->next) cmd->temp_executed = FALSE; - o_stream_cork(client->output); if (client->output_lock != NULL) { client->output_lock->temp_executed = TRUE; client_output_cmd(client->output_lock); diff --git a/src/pop3/pop3-client.c b/src/pop3/pop3-client.c index cfb125134b..63d7361d0a 100644 --- a/src/pop3/pop3-client.c +++ b/src/pop3/pop3-client.c @@ -641,6 +641,7 @@ static void client_input(struct client *client) static int client_output(struct client *client) { + o_stream_cork(client->output); if (o_stream_flush(client->output) < 0) { client_destroy(client, NULL); return 1; @@ -651,11 +652,8 @@ static int client_output(struct client *client) if (client->to_commit != NULL) timeout_reset(client->to_commit); - if (client->cmd != NULL) { - o_stream_cork(client->output); + if (client->cmd != NULL) client->cmd(client); - o_stream_uncork(client->output); - } if (client->cmd == NULL) { if (o_stream_get_buffer_used_size(client->output) < @@ -668,6 +666,7 @@ static int client_output(struct client *client) client_input(client); } + o_stream_uncork(client->output); return client->cmd == NULL; }