- struct io_conn *ready = NULL;
-
- if (io_plan_nodebug) {
- io_plan_nodebug = false;
- return plan;
- }
-
- if (!current || !doing_debug_on(current)) {
- if (!io_debug_wakeup)
- return plan;
- }
-
- io_debug_wakeup = false;
- current->plan = plan;
- backend_plan_changed(current);
-
- /* If it closed, close duplex. */
- if (!current->plan.next && current->duplex) {
- current->duplex->plan = io_close_();
- backend_plan_changed(current->duplex);
- }
-
- /* Call back into the loop immediately. */
- io_loop_return = do_io_loop(&ready);
-
- if (ready) {
- set_current(ready);
- if (!ready->plan.next) {
- /* Call finish function immediately. */
- if (ready->finish) {
- errno = ready->plan.u1.s;
- ready->finish(ready, ready->finish_arg);
- ready->finish = NULL;
- }
- backend_del_conn(ready);
- } else {
- /* Calls back in itself, via io_debug_io(). */
- if (ready->plan.io(ready->fd.fd, &ready->plan) != 2)
- abort();
- }
- set_current(NULL);
- }