]> git.ozlabs.org Git - ccan/blobdiff - ccan/io/test/run-08-read-after-hangup.c
io: change io_idle() to io_wait()
[ccan] / ccan / io / test / run-08-read-after-hangup.c
index b73139e4f4c7a256c1e00301dce63c67622c1869..f6b3db1cb9fd45338d57b5012c00ca9a38a9197e 100644 (file)
@@ -11,10 +11,15 @@ static char inbuf[8];
 
 static struct io_plan wake_it(struct io_conn *conn, struct io_conn *reader)
 {
 
 static struct io_plan wake_it(struct io_conn *conn, struct io_conn *reader)
 {
-       io_wake(reader, io_read(inbuf, 8, io_close_cb, NULL));
+       io_wake(inbuf);
        return io_close();
 }
 
        return io_close();
 }
 
+static struct io_plan read_buf(struct io_conn *conn, void *unused)
+{
+       return io_read(inbuf, 8, io_close_cb, NULL);
+}
+
 int main(void)
 {
        int fds[2];
 int main(void)
 {
        int fds[2];
@@ -23,7 +28,7 @@ int main(void)
        plan_tests(3);
 
        ok1(pipe(fds) == 0);
        plan_tests(3);
 
        ok1(pipe(fds) == 0);
-       conn = io_new_conn(fds[0], io_idle());
+       conn = io_new_conn(fds[0], io_wait(inbuf, read_buf, NULL));
        io_new_conn(fds[1], io_write("EASYTEST", 8, wake_it, conn));
 
        ok1(io_loop() == NULL);
        io_new_conn(fds[1], io_write("EASYTEST", 8, wake_it, conn));
 
        ok1(io_loop() == NULL);