]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap, pop3: Cork TCP connection before trying to flush output in output callback.
authorTimo Sirainen <tss@iki.fi>
Thu, 14 Oct 2010 15:58:57 +0000 (16:58 +0100)
committerTimo Sirainen <tss@iki.fi>
Thu, 14 Oct 2010 15:58:57 +0000 (16:58 +0100)
src/imap/imap-client.c
src/pop3/pop3-client.c

index f4b88ce09f990f4bc18a98cfea9a0fadb61de65d..95cd8e9cb30276eae330a77cce4a4519504d1fbf 100644 (file)
@@ -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);
index cfb125134ba879dc506927aa98042f0fa97f41ef..63d7361d0a37199eec4db920f6c294be777290ff 100644 (file)
@@ -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;
 }