X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fio%2Ftest%2Frun-16-duplex-test.c;h=8631be4519f58a0e0603da35e1d539b34af1dcd8;hp=ea588661f7f091f2532da8fc717fb50dcf54cced;hb=d8ecdc8021b532fe76f001290fcd79c4fb9e1323;hpb=94dd4c2bddd0dc080ad5b85465fa3f45f486967a diff --git a/ccan/io/test/run-16-duplex-test.c b/ccan/io/test/run-16-duplex-test.c index ea588661..8631be45 100644 --- a/ccan/io/test/run-16-duplex-test.c +++ b/ccan/io/test/run-16-duplex-test.c @@ -8,7 +8,9 @@ #include #include -#ifndef PORT +#ifdef DEBUG_CONN +#define PORT "64016" +#else #define PORT "65016" #endif @@ -27,13 +29,14 @@ 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) { +#ifdef DEBUG_CONN + io_set_debug(conn, true); +#endif ok1(d->state == 0); d->state++; @@ -43,7 +46,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)); }