From: Timo Sirainen Date: Fri, 21 Jan 2011 17:15:37 +0000 (+0200) Subject: zlib: Make sure output stream flushes the stream automatically when not corked. X-Git-Tag: 2.0.10~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5cbd6f3ed012b827f181f5f214584f20641b9719;p=thirdparty%2Fdovecot%2Fcore.git zlib: Make sure output stream flushes the stream automatically when not corked. Fixes hangs with IMAP COMPRESS extension. --- diff --git a/src/plugins/zlib/ostream-zlib.c b/src/plugins/zlib/ostream-zlib.c index a3f9dc35ab..bd2b27a701 100644 --- a/src/plugins/zlib/ostream-zlib.c +++ b/src/plugins/zlib/ostream-zlib.c @@ -129,7 +129,8 @@ o_stream_zlib_send_chunk(struct zlib_ostream *zstream, } zstream->crc = crc32_data_more(zstream->crc, data, size); zstream->bytes32 += size; - zstream->flushed = FALSE; + zstream->flushed = flush == Z_SYNC_FLUSH && + zs->avail_out == sizeof(zstream->outbuf); return 0; } @@ -222,8 +223,12 @@ o_stream_zlib_sendv(struct ostream_private *stream, return -1; bytes += iov[i].iov_len; } - stream->ostream.offset += bytes; + + if (!zstream->ostream.corked) { + if (o_stream_zlib_send_flush(zstream) < 0) + return -1; + } return bytes; }