Mercurial > dovecot > core-2.2
changeset 12408:631e0d846e57
istream-[b]zlib: Corking now affects also the parent stream.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 09 Nov 2010 21:03:34 +0000 |
parents | e2a880387cca |
children | fa62e1a578a0 |
files | src/plugins/zlib/ostream-bzlib.c src/plugins/zlib/ostream-zlib.c |
diffstat | 2 files changed, 28 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/zlib/ostream-bzlib.c Tue Nov 09 20:25:36 2010 +0000 +++ b/src/plugins/zlib/ostream-bzlib.c Tue Nov 09 21:03:34 2010 +0000 @@ -119,6 +119,19 @@ return 0; } +static void o_stream_bzlib_cork(struct ostream_private *stream, bool set) +{ + struct bzlib_ostream *zstream = (struct bzlib_ostream *)stream; + + stream->corked = set; + if (set) + o_stream_cork(zstream->output); + else { + (void)o_stream_flush(&stream->ostream); + o_stream_uncork(zstream->output); + } +} + static int o_stream_bzlib_flush(struct ostream_private *stream) { struct bzlib_ostream *zstream = (struct bzlib_ostream *)stream; @@ -161,6 +174,7 @@ zstream = i_new(struct bzlib_ostream, 1); zstream->ostream.sendv = o_stream_bzlib_sendv; + zstream->ostream.cork = o_stream_bzlib_cork; zstream->ostream.flush = o_stream_bzlib_flush; zstream->ostream.iostream.close = o_stream_bzlib_close; zstream->output = output;
--- a/src/plugins/zlib/ostream-zlib.c Tue Nov 09 20:25:36 2010 +0000 +++ b/src/plugins/zlib/ostream-zlib.c Tue Nov 09 21:03:34 2010 +0000 @@ -181,6 +181,19 @@ return 0; } +static void o_stream_zlib_cork(struct ostream_private *stream, bool set) +{ + struct zlib_ostream *zstream = (struct zlib_ostream *)stream; + + stream->corked = set; + if (set) + o_stream_cork(zstream->output); + else { + (void)o_stream_flush(&stream->ostream); + o_stream_uncork(zstream->output); + } +} + static int o_stream_zlib_flush(struct ostream_private *stream) { struct zlib_ostream *zstream = (struct zlib_ostream *)stream; @@ -240,6 +253,7 @@ zstream = i_new(struct zlib_ostream, 1); zstream->ostream.sendv = o_stream_zlib_sendv; + zstream->ostream.cork = o_stream_zlib_cork; zstream->ostream.flush = o_stream_zlib_flush; zstream->ostream.iostream.close = o_stream_zlib_close; zstream->output = output;