-#ifdef DEBUG
-bool io_plan_for_other;
-struct io_conn *current;
-bool (*io_debug)(struct io_conn *conn);
-bool io_debug_wakeup;
-
-void io_plan_debug(struct io_plan *plan)
-{
- if (io_plan_for_other) {
- io_plan_for_other = false;
- return;
- }
-
- if (!io_debug || !current)
- return;
-
- if (!io_debug(current) && !io_debug_wakeup)
- return;
-
- io_debug_wakeup = false;
- current->plan = *plan;
- backend_plan_changed(current);
-
- /* Call back into the loop immediately. */
- io_loop_return = io_loop();
-}
-
-static void debug_io_wake(struct io_conn *conn)
-{
- /* We want linear if we wake a debugged connection, too. */
- if (io_debug && io_debug(conn))
- io_debug_wakeup = true;
-}
-#else
-static void debug_io_wake(struct io_conn *conn)
-{
-}
-#endif
-
-struct io_listener *io_new_listener_(int fd,
- void (*init)(int fd, void *arg),
+struct io_listener *io_new_listener_(const tal_t *ctx, int fd,
+ struct io_plan *(*init)(struct io_conn *,
+ void *),