- /* Re-initialize, for next time. */
- list_node_init(&conn->always);
- io_do_always(conn);
- ret = true;
+ if (!fds[i]->exclusive[IO_IN])
+ pfd->events &= ~POLLIN;
+ if (!fds[i]->exclusive[IO_OUT])
+ pfd->events &= ~POLLOUT;
+
+ /* If we're not listening, we don't want error events
+ * either. */
+ if (!pfd->events)
+ pfd->fd = -fds[i]->fd - 1;
+ }
+}
+
+static void restore_pollfds(void)
+{
+ if (num_exclusive == 0)
+ return;
+
+ for (size_t i = 0; i < num_fds; i++) {
+ struct pollfd *pfd = &pollfds[fds[i]->backend_info];
+
+ if (fds[i]->listener) {
+ pfd->events = POLLIN;
+ pfd->fd = fds[i]->fd;
+ } else {
+ struct io_conn *conn = (void *)fds[i];
+ setup_pfd(conn, pfd);
+ }