if (shutdown(io_conn_fd(conn), SHUT_WR) != 0)
return io_close(conn);
- /* And leave unset .*/
- return &conn->plan[IO_IN];
+ /* We need to make sure we don't try to write again, so
+ * "wait" on something which will never be woken.
+ *
+ * In the duplex case, we can call io_sock_shutdown on the
+ * input side, while io_write is going on on the output side.
+ * Then we will try to write, fail, and immediately close. */
+ return io_wait_dir(conn, io_sock_shutdown, IO_OUT, io_never, NULL);
}
bool io_flush_sync(struct io_conn *conn)