}
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);
}
c = (void *)fds[i];
if (c->plan[IO_IN].status == IO_WAITING
&& c->plan[IO_IN].arg.u1.const_vp == wait)
- io_do_wakeup(c, &c->plan[IO_IN]);
+ io_do_wakeup(c, IO_IN);
if (c->plan[IO_OUT].status == IO_WAITING
&& c->plan[IO_OUT].arg.u1.const_vp == wait)
- io_do_wakeup(c, &c->plan[IO_OUT]);
+ io_do_wakeup(c, IO_OUT);
}
}