]> git.ozlabs.org Git - ccan/blobdiff - ccan/io/io.c
ccan: Correct some poor conventions in _info includes
[ccan] / ccan / io / io.c
index a1610a405230da40ec725dbc1163564b685986b6..3f618249d279d260d77c60aa8ac1c87645a0378b 100644 (file)
@@ -198,7 +198,7 @@ struct io_conn *io_duplex_(struct io_conn *old, struct io_plan plan)
        return conn;
 }
 
-bool io_timeout_(struct io_conn *conn, struct timespec ts,
+bool io_timeout_(struct io_conn *conn, struct timerel t,
                 struct io_plan (*cb)(struct io_conn *, void *), void *arg)
 {
        assert(cb);
@@ -212,7 +212,7 @@ bool io_timeout_(struct io_conn *conn, struct timespec ts,
 
        conn->timeout->next = cb;
        conn->timeout->next_arg = arg;
-       backend_add_timeout(conn, ts);
+       backend_add_timeout(conn, t);
        return true;
 }
 
@@ -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. */