From: Timo Sirainen Date: Mon, 9 Oct 2017 10:19:32 +0000 (+0300) Subject: lib: ostream-multiplex - set ostream_private.parent X-Git-Tag: 2.3.0.rc1~861 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bb5678d8e52e006c68203594ce48485a8682b79;p=thirdparty%2Fdovecot%2Fcore.git 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 --- diff --git a/src/lib/ostream-multiplex.c b/src/lib/ostream-multiplex.c index d944b88209..7efcd5f3bb 100644 --- a/src/lib/ostream-multiplex.c +++ b/src/lib/ostream-multiplex.c @@ -184,13 +184,11 @@ o_stream_add_channel_real(struct multiplex_ostream *mstream, uint8_t cid) 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)