]> git.ozlabs.org Git - ccan/blobdiff - ccan/io/test/run-16-duplex-test.c
ccan/io: implement debug.
[ccan] / ccan / io / test / run-16-duplex-test.c
index ea588661f7f091f2532da8fc717fb50dcf54cced..2081418334ba51b90f20dfe04edad5ea0f4053a8 100644 (file)
@@ -8,7 +8,9 @@
 #include <sys/wait.h>
 #include <stdio.h>
 
-#ifndef PORT
+#ifdef DEBUG_CONN
+#define PORT "64016"
+#else
 #define PORT "65016"
 #endif
 
@@ -34,6 +36,9 @@ static struct io_plan *io_done(struct io_conn *conn, struct data *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++;
 
@@ -43,7 +48,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));
 }