bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2017-2018 Dovecot authors, see the included COPYING file */
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi struct ostream *os2 = o_stream_create_multiplex(os, (size_t)-1);
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi struct ostream *os3 = o_stream_multiplex_add_channel(os2, 1);
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi test_assert(o_stream_send_str(os2, "hello") == 5);
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi test_assert(o_stream_send_str(os3, "world") == 5);
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi test_assert(memcmp(result->data, expected, I_MIN(sizeof(expected),
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomistatic void test_ostream_multiplex_stream_read(struct istream *is)
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi /* parse stream */
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi } else if (dlen == 0) {
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi test_assert_idx(data[pos] < 2, channel_counter[cid]);
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi if (channel_counter[0] > 100 && channel_counter[1] > 100)
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomistatic void test_ostream_multiplex_stream_write(struct ostream *channel ATTR_UNUSED)
bc038dfe3ea41392ab50cd4c1c1fdd620cc3deefAki Tuomi o_stream_nsend_str(chan1, msgs[i_rand() % N_ELEMENTS(msgs)]);
bc038dfe3ea41392ab50cd4c1c1fdd620cc3deefAki Tuomi o_stream_nsend_str(chan0, msgs[i_rand() % N_ELEMENTS(msgs)]);
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi struct ostream *os = o_stream_create_fd(fds[1], (size_t)-1);
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi struct istream *is = i_stream_create_fd(fds[0], (size_t)-1);
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi chan0 = o_stream_create_multiplex(os, (size_t)-1);
1de7b73a11afda43323410a4481d866930b1e632Aki Tuomi io_add_istream(is, test_ostream_multiplex_stream_read, is);