X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2Ftest%2Frun-16-duplex-test.c;h=007f41119614e2016a2d3aef21f7ba9d9465febb;hb=31c816a6a9a2037d8860d56814835d9ac488d52f;hp=ea588661f7f091f2532da8fc717fb50dcf54cced;hpb=94dd4c2bddd0dc080ad5b85465fa3f45f486967a;p=ccan diff --git a/ccan/io/test/run-16-duplex-test.c b/ccan/io/test/run-16-duplex-test.c index ea588661..007f4111 100644 --- a/ccan/io/test/run-16-duplex-test.c +++ b/ccan/io/test/run-16-duplex-test.c @@ -8,9 +8,7 @@ #include #include -#ifndef PORT #define PORT "65016" -#endif struct data { struct io_listener *l; @@ -27,9 +25,7 @@ static void finish_ok(struct io_conn *conn, struct data *d) static struct io_plan *io_done(struct io_conn *conn, struct data *d) { d->state++; - if (d->state == 3) - return io_close(conn); - return io_wait(conn, d, io_close_cb, NULL); + return io_halfclose(conn); } static struct io_plan *init_conn(struct io_conn *conn, struct data *d) @@ -43,7 +39,8 @@ static struct io_plan *init_conn(struct io_conn *conn, struct data *d) io_close_listener(d->l); - return io_duplex(io_read(conn, d->buf, sizeof(d->buf), io_done, d), + return io_duplex(conn, + io_read(conn, d->buf, sizeof(d->buf), io_done, d), io_write(conn, d->wbuf, sizeof(d->wbuf), io_done, d)); }