]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-imap: When sending "+ OK" to client, uncork ostream immediately
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 27 Oct 2017 21:48:01 +0000 (00:48 +0300)
committerTimo Sirainen <tss@dovecot.fi>
Mon, 30 Oct 2017 11:04:53 +0000 (13:04 +0200)
This makes sure that it's sent to the client as soon as possible.

Also removed o_stream_nflush(), since uncorking does that already.
If there is no corking, the "+ OK" was already attempted to be sent
by the o_stream_nsend() call and a flush is unlikely to help.

src/lib-imap/imap-parser.c

index 2b75a40017e72ca28546bc9f0a154f593802b9f1..a682b6b47de451b3d6321e3b75e2bf2a8bd5a951 100644 (file)
@@ -414,7 +414,12 @@ static bool imap_parser_literal_end(struct imap_parser *parser)
 
                if (parser->output != NULL && !parser->literal_nonsync) {
                        o_stream_nsend(parser->output, "+ OK\r\n", 6);
-                       o_stream_nflush(parser->output);
+                       if (o_stream_is_corked(parser->output)) {
+                               /* make sure this continuation is sent to the
+                                  client as soon as possible */
+                               o_stream_uncork(parser->output);
+                               o_stream_cork(parser->output);
+                       }
                }
        }