Commit 31df8231 authored by Rusty Russell's avatar Rusty Russell

ccan/io: use shutdown() before close.

During a debugging session, I wondered why poll() wasn't exiting
when I killed a (local) peer.
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 0fbc7909
...@@ -78,6 +78,12 @@ static void del_fd(struct fd *fd) ...@@ -78,6 +78,12 @@ static void del_fd(struct fd *fd)
} }
num_fds--; num_fds--;
fd->backend_info = -1; 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); close(fd->fd);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment