]> git.ozlabs.org Git - ccan/blobdiff - ccan/io/test/run-08-hangup-on-idle.c
io: change io_idle() to io_wait()
[ccan] / ccan / io / test / run-08-hangup-on-idle.c
index 7463dd98c83e592525fc09b0a30ea250681fef20..c8257703d3333ef2a5199db85b7232022157102a 100644 (file)
@@ -12,7 +12,12 @@ static struct io_plan timeout_wakeup(struct io_conn *conn, char *buf)
 {
        /* This kills the dummy connection. */
        close(fds2[1]);
-       return io_read(buf, 16, io_close, NULL);
+       return io_read(buf, 16, io_close_cb, NULL);
+}
+
+static struct io_plan never(struct io_conn *conn, void *unused)
+{
+       abort();
 }
 
 int main(void)
@@ -26,12 +31,13 @@ int main(void)
        ok1(pipe(fds) == 0);
 
        /* Write then close. */
-       io_new_conn(fds[1], io_write("hello there world", 16, io_close, NULL));
-       conn = io_new_conn(fds[0], io_idle());
+       io_new_conn(fds[1], io_write("hello there world", 16,
+                                    io_close_cb, NULL));
+       conn = io_new_conn(fds[0], io_wait(buf, never, NULL));
 
        /* To avoid assert(num_waiting) */
        ok1(pipe(fds2) == 0);
-       io_new_conn(fds2[0], io_read(buf, 16, io_close, NULL));
+       io_new_conn(fds2[0], io_read(buf, 16, io_close_cb, NULL));
 
        /* After half a second, it will read. */
        io_timeout(conn, time_from_msec(500), timeout_wakeup, buf);