]> git.ozlabs.org Git - ccan/blobdiff - ccan/io/test/run-14-duplex-both-read.c
io: typo fixes.
[ccan] / ccan / io / test / run-14-duplex-both-read.c
index 8cf22aa16cfc6a5febe0fef0e4c2342dcb190340..ed77cab8ac69d4530f0525c24f6c1db22407fb17 100644 (file)
@@ -8,9 +8,7 @@
 #include <sys/wait.h>
 #include <stdio.h>
 
-#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));
 }