From ce27b5647d5065c05db04c67e51574253275a3c2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 9 Jan 2017 12:33:44 +1030 Subject: [PATCH] io: don't try to close() connection twice, remove shutdown logic. We were closing before calling del_fd, which also closed. The shutdown() logic applies when a child and parent are using the *same* socket fd to communicate to each other. That's really unusual (who would you connect to?), and should probably be done by the user. Generally, you'd use socketpair() for this child-parent case. Signed-off-by: Rusty Russell --- ccan/io/poll.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/ccan/io/poll.c b/ccan/io/poll.c index 6738f720..bd481e94 100644 --- a/ccan/io/poll.c +++ b/ccan/io/poll.c @@ -86,13 +86,6 @@ static void del_fd(struct fd *fd) } num_fds--; fd->backend_info = -1; - - /* Closing a local socket doesn't wake poll() because other end - * has them open. See 2.6. When should I use shutdown()? - * in http://www.faqs.org/faqs/unix-faq/socket/ */ - shutdown(fd->fd, SHUT_RDWR); - - close(fd->fd); } static void destroy_listener(struct io_listener *l) -- 2.39.2