X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2Ftest%2Frun-14-duplex-both-read.c;h=30c46cd5dbd79fd2909a5a36339cd2b7a8089a88;hb=8f116a81b39b55031212abb0be2ad088cbf9fd87;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..30c46cd5 100644 --- a/ccan/io/test/run-14-duplex-both-read.c +++ b/ccan/io/test/run-14-duplex-both-read.c @@ -8,7 +8,9 @@ #include #include -#ifndef PORT +#ifdef DEBUG_CONN +#define PORT "64014" +#else #define PORT "65014" #endif @@ -27,22 +29,27 @@ 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)); } static struct io_plan *init_conn(struct io_conn *conn, struct data *d) { +#ifdef DEBUG_CONN + io_set_debug(conn, true); +#endif ok1(d->state == 0); d->state++;