X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2Ftest%2Frun-08-hangup-on-idle.c;h=c8257703d3333ef2a5199db85b7232022157102a;hb=ab6e77749bfe678bde2cdf1442145bfbcaea253d;hp=364d7943ac1ae368df886dabbb7369559037b4f9;hpb=cf86c1e30648c9b482b92444c39ea6ea0ff936a8;p=ccan diff --git a/ccan/io/test/run-08-hangup-on-idle.c b/ccan/io/test/run-08-hangup-on-idle.c index 364d7943..c8257703 100644 --- a/ccan/io/test/run-08-hangup-on-idle.c +++ b/ccan/io/test/run-08-hangup-on-idle.c @@ -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,13 +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), - NULL, NULL); - conn = io_new_conn(fds[0], io_idle(), NULL, NULL); + 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), NULL, 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);