io: don't close if already closing in io_close_other.
authorRusty Russell <rusty@rustcorp.com.au>
Sun, 13 Apr 2014 11:55:37 +0000 (21:25 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 24 Apr 2014 06:44:26 +0000 (16:14 +0930)
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/io/io.c

index a1610a405230da40ec725dbc1163564b685986b6..4c73b62455693f6ae5c633c910921583cd3a5089 100644 (file)
@@ -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. */