X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2Ftest%2Frun-14-duplex-both-read.c;h=ed77cab8ac69d4530f0525c24f6c1db22407fb17;hb=9b3f4ef6eec6a5981dcaa62f45da49b8f4f95388;hp=8cf22aa16cfc6a5febe0fef0e4c2342dcb190340;hpb=94dd4c2bddd0dc080ad5b85465fa3f45f486967a;p=ccan diff --git a/ccan/io/test/run-14-duplex-both-read.c b/ccan/io/test/run-14-duplex-both-read.c index 8cf22aa1..ed77cab8 100644 --- a/ccan/io/test/run-14-duplex-both-read.c +++ b/ccan/io/test/run-14-duplex-both-read.c @@ -8,9 +8,7 @@ #include #include -#ifndef PORT #define PORT "65014" -#endif struct data { struct io_listener *l; @@ -27,17 +25,19 @@ static void finish_ok(struct io_conn *conn, struct data *d) static struct io_plan *end(struct io_conn *conn, struct data *d) { d->state++; + /* Close on top of halfclose should work. */ if (d->state == 4) return io_close(conn); else - return io_wait(conn, NULL, io_never, NULL); + return io_halfclose(conn); } static struct io_plan *make_duplex(struct io_conn *conn, struct data *d) { d->state++; /* Have duplex read the rest of the buffer. */ - return io_duplex(io_read(conn, d->buf+1, sizeof(d->buf)-1, end, d), + return io_duplex(conn, + io_read(conn, d->buf+1, sizeof(d->buf)-1, end, d), io_write(conn, d->wbuf, sizeof(d->wbuf), end, d)); }