changeset 13532:62e1c575b16a

ostream: Keep track of flush callback for filter ostreams as well.
author Timo Sirainen <tss@iki.fi>
date Wed, 21 Sep 2011 15:53:00 +0300
parents 0fb296c11edc
children e0bee6c56a05
files src/lib/ostream.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ostream.c	Wed Sep 21 15:51:00 2011 +0300
+++ b/src/lib/ostream.c	Wed Sep 21 15:53:00 2011 +0300
@@ -323,14 +323,11 @@
 				    stream_flush_callback_t *callback,
 				    void *context)
 {
-	if (_stream->parent == NULL) {
-		_stream->callback = callback;
-		_stream->context = context;
-	} else {
-		/* this is a filter stream, we don't have a flush
-		   callback ourself */
+	if (_stream->parent != NULL)
 		o_stream_set_flush_callback(_stream->parent, callback, context);
-	}
+
+	_stream->callback = callback;
+	_stream->context = context;
 }
 
 static void
@@ -385,6 +382,10 @@
 	if (parent != NULL) {
 		_stream->parent = parent;
 		o_stream_ref(parent);
+
+		_stream->callback = parent->real_stream->callback;
+		_stream->context = parent->real_stream->context;
+		_stream->max_buffer_size = parent->real_stream->max_buffer_size;
 	}
 
 	if (_stream->iostream.close == NULL)