From 414bbc6dfb81276908f130354890b143cbf1203c Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 28 Oct 2017 00:48:01 +0300 Subject: [PATCH] lib-imap: When sending "+ OK" to client, uncork ostream immediately 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib-imap/imap-parser.c b/src/lib-imap/imap-parser.c index 2b75a40017..a682b6b47d 100644 --- a/src/lib-imap/imap-parser.c +++ b/src/lib-imap/imap-parser.c @@ -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); + } } }