Browse Source

io: don't close if already closing in io_close_other.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Rusty Russell 12 years ago
parent
commit
ab6e77749b
1 changed files with 5 additions and 2 deletions
  1. 5 2
      ccan/io/io.c

+ 5 - 2
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. */