dovecot-2.0: istream-[b]zlib: Corking now affects also the paren...

dovecot at dovecot.org dovecot at dovecot.org
Tue Nov 9 23:03:38 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/631e0d846e57
changeset: 12408:631e0d846e57
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Nov 09 21:03:34 2010 +0000
description:
istream-[b]zlib: Corking now affects also the parent stream.

diffstat:

 src/plugins/zlib/ostream-bzlib.c |  14 ++++++++++++++
 src/plugins/zlib/ostream-zlib.c  |  14 ++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diffs (62 lines):

diff -r e2a880387cca -r 631e0d846e57 src/plugins/zlib/ostream-bzlib.c
--- 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;
diff -r e2a880387cca -r 631e0d846e57 src/plugins/zlib/ostream-zlib.c
--- 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;


More information about the dovecot-cvs mailing list