#include <sys/wait.h>
#include <stdio.h>
-#ifndef PORT
+#ifdef DEBUG_CONN
+#define PORT "64014"
+#else
#define PORT "65014"
#endif
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++;