iostream-proxy may have closed the proxy with istream first, which closed
the fd, followed by closing the ostream, which attempted to remove IO for
the already closed fd.
Use iostream_fd refcounting to make sure the fd isn't closed too early.
Fixes:
Panic: epoll_ctl(del, 22) failed: Bad file descriptor
fd_set_nonblock(fds[0], TRUE);
fd_set_nonblock(fds[1], TRUE);
- struct ostream *output = o_stream_create_fd(fds[0], IO_BLOCK_SIZE);
- struct istream *input =
- i_stream_create_fd_autoclose(&fds[0], IO_BLOCK_SIZE);
+ struct ostream *output;
+ struct istream *input;
+ io_stream_create_fd_autoclose(&fds[0], IO_BLOCK_SIZE, IO_BLOCK_SIZE,
+ &input, &output);
o_stream_set_no_error_handling(output, TRUE);
i_assert(client->io == NULL);