From: Rusty Russell Date: Sun, 13 Apr 2014 11:55:37 +0000 (+0930) Subject: io: don't close if already closing in io_close_other. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=ab6e77749bfe678bde2cdf1442145bfbcaea253d io: don't close if already closing in io_close_other. Signed-off-by: Rusty Russell --- diff --git a/ccan/io/io.c b/ccan/io/io.c index a1610a40..4c73b624 100644 --- a/ccan/io/io.c +++ b/ccan/io/io.c @@ -490,8 +490,11 @@ struct io_plan io_close_cb(struct io_conn *conn, void *arg) void io_close_other(struct io_conn *conn) { - conn->plan = io_close_(); - backend_plan_changed(conn); + /* Don't close if already closing! */ + if (conn->plan.next) { + conn->plan = io_close_(); + backend_plan_changed(conn); + } } /* Exit the loop, returning this (non-NULL) arg. */