changeset 22585:e1ad624fc2ad

lib: ostream-multiplex - set ostream_private.parent Unlike with istream-multiplex, there are no issues with I/Os. Only the parent stream will have the I/O. Using the default parent adds the missing methods that otherwise would have needed to be implemented: - cork - flush_pending - switch_ioloop
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 09 Oct 2017 13:19:32 +0300
parents 51b74dbe1ce9
children 234364d58e5b
files src/lib/ostream-multiplex.c
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ostream-multiplex.c	Mon Oct 09 13:14:23 2017 +0300
+++ b/src/lib/ostream-multiplex.c	Mon Oct 09 13:19:32 2017 +0300
@@ -184,13 +184,11 @@
 	channel->ostream.sendv = o_stream_multiplex_ochannel_sendv;
 	channel->ostream.iostream.close = o_stream_multiplex_ochannel_close;
 	channel->ostream.iostream.destroy = o_stream_multiplex_ochannel_destroy;
-	if (cid == 0)
-		channel->ostream.fd = o_stream_get_fd(mstream->parent);
-	else
-		channel->ostream.fd = -1;
+	channel->ostream.fd = o_stream_get_fd(mstream->parent);
 	array_append(&channel->mstream->channels, &channel, 1);
 
-	return o_stream_create(&channel->ostream, NULL, mstream->bufsize);
+	return o_stream_create(&channel->ostream, mstream->parent,
+			       mstream->bufsize);
 }
 
 struct ostream *o_stream_multiplex_add_channel(struct ostream *stream, uint8_t cid)