X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fio%2Ftest%2Frun-08-read-after-hangup.c;h=f6b3db1cb9fd45338d57b5012c00ca9a38a9197e;hp=b73139e4f4c7a256c1e00301dce63c67622c1869;hb=f7ab2c65d40839a327e50876dc2708ab7b11aa52;hpb=cdf62dce7077a9f9a818edbb67d31d033cbb73c6 diff --git a/ccan/io/test/run-08-read-after-hangup.c b/ccan/io/test/run-08-read-after-hangup.c index b73139e4..f6b3db1c 100644 --- a/ccan/io/test/run-08-read-after-hangup.c +++ b/ccan/io/test/run-08-read-after-hangup.c @@ -11,10 +11,15 @@ 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_cb, 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) { int fds[2]; @@ -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);