summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2014-08-08 12:55:12 +0930
committerRusty Russell <rusty@rustcorp.com.au>2014-08-08 12:55:12 +0930
commit8d94c52a7d6a51fd3a95734b2b4c7daa8c687d91 (patch)
tree21fbefb33a945e5f3ef9bf43483cd76fe0d8e16b
parent31df8231a077488a9f4010a8863ca38993aa69c8 (diff)
io: don't do wakeup immediately.
ccan/io users don't expect to deal with callbacks inside each other; we should just mark woken connections as if they were io_always. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--ccan/io/backend.h2
-rw-r--r--ccan/io/io.c7
-rw-r--r--ccan/io/poll.c4
3 files changed, 8 insertions, 5 deletions
diff --git a/ccan/io/backend.h b/ccan/io/backend.h
index 2c03a98a..39605ec4 100644
--- a/ccan/io/backend.h
+++ b/ccan/io/backend.h
@@ -88,6 +88,6 @@ void backend_del_conn(struct io_conn *conn);
void io_ready(struct io_conn *conn, int pollflags);
void io_do_always(struct io_conn *conn);
-void io_do_wakeup(struct io_conn *conn, struct io_plan *plan);
+void io_do_wakeup(struct io_conn *conn, enum io_direction dir);
void *do_io_loop(struct io_conn **ready);
#endif /* CCAN_IO_BACKEND_H */
diff --git a/ccan/io/io.c b/ccan/io/io.c
index c0af6bf7..7dbb9c5a 100644
--- a/ccan/io/io.c
+++ b/ccan/io/io.c
@@ -384,10 +384,13 @@ void io_do_always(struct io_conn *conn)
next_plan(conn, &conn->plan[IO_OUT]);
}
-void io_do_wakeup(struct io_conn *conn, struct io_plan *plan)
+void io_do_wakeup(struct io_conn *conn, enum io_direction dir)
{
+ struct io_plan *plan = &conn->plan[dir];
+
assert(plan->status == IO_WAITING);
- next_plan(conn, plan);
+
+ set_always(conn, dir, plan->next, plan->next_arg);
}
/* Close the connection, we're done. */
diff --git a/ccan/io/poll.c b/ccan/io/poll.c
index 8f77dd42..7af61d5a 100644
--- a/ccan/io/poll.c
+++ b/ccan/io/poll.c
@@ -158,11 +158,11 @@ void backend_wake(const void *wait)
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);
}
}