X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2Ftest%2Frun-08-read-after-hangup.c;h=f6b3db1cb9fd45338d57b5012c00ca9a38a9197e;hb=12e924346b342c61219a3fdc57eb6b00a27f1cd1;hp=56d9a164accddbbd40ba290016a2486a008fd45d;hpb=0f16a4197c94bfa84dad56d0cb9a9c20438d0a45;p=ccan diff --git a/ccan/io/test/run-08-read-after-hangup.c b/ccan/io/test/run-08-read-after-hangup.c index 56d9a164..f6b3db1c 100644 --- a/ccan/io/test/run-08-read-after-hangup.c +++ b/ccan/io/test/run-08-read-after-hangup.c @@ -11,8 +11,13 @@ static char inbuf[8]; static struct io_plan wake_it(struct io_conn *conn, struct io_conn *reader) { - io_wake(reader, io_read(inbuf, 8, io_close, NULL)); - return io_close(conn, NULL); + io_wake(inbuf); + 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) @@ -23,7 +28,7 @@ int main(void) 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);