X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2Fpoll.c;h=043feff74046226e61c367ad68644f3aba3fb54e;hb=9b3f4ef6eec6a5981dcaa62f45da49b8f4f95388;hp=98a64f42fbe4336283be8f5371688da439943ac6;hpb=17a81baf84a9c8f89603173be3169a0a2017702d;p=ccan diff --git a/ccan/io/poll.c b/ccan/io/poll.c index 98a64f42..043feff7 100644 --- a/ccan/io/poll.c +++ b/ccan/io/poll.c @@ -187,11 +187,10 @@ bool add_conn(struct io_conn *c) return true; } -struct io_plan *io_close_taken_fd(struct io_conn *conn) +void cleanup_conn_without_close(struct io_conn *conn) { tal_del_destructor(conn, destroy_conn_close_fd); destroy_conn(conn, false); - return io_close(conn); } static void accept_conn(struct io_listener *l) @@ -282,9 +281,14 @@ void *io_loop(struct timers *timers, struct timer **expired) break; if (fds[i]->listener) { + struct io_listener *l = (void *)fds[i]; if (events & POLLIN) { - accept_conn((void *)c); + accept_conn(l); r--; + } else if (events & (POLLHUP|POLLNVAL|POLLERR)) { + r--; + errno = EBADF; + io_close_listener(l); } } else if (events & (POLLIN|POLLOUT)) { r--;