{
struct io_file *io;
- i_assert(fd >= 0);
i_assert(callback != NULL);
i_assert((condition & IO_NOTIFY) == 0);
if (io->io.ioloop->handler_context == NULL)
io_loop_initialize_handler(io->io.ioloop);
- io_loop_handle_add(io);
+ if (fd != -1)
+ io_loop_handle_add(io);
+ else {
+ /* we're adding an istream whose only way to get notified
+ is to call i_stream_set_input_pending() */
+ }
if (io->io.ioloop->io_files != NULL) {
io->io.ioloop->io_files->prev = io;
{
struct io_file *io;
+ i_assert(fd >= 0);
io = io_add_file(fd, condition, source_linenum, callback, context);
return &io->io;
}
}
io_file_unlink(io_file);
- io_loop_handle_remove(io_file, closed);
+ if (io_file->fd != -1)
+ io_loop_handle_remove(io_file, closed);
}
}