X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fio%2Ftest%2Frun-05-write.c;h=5319def8f2cc28c6921b2b611a2c99b013b1402d;hb=efd79fad55845cf71f822cda6b334a2b9eb27baf;hp=e878c33054776e00406488e00a04e17aeecf8e3a;hpb=57d9d1be33905691ec756b14b066181ca6850ced;p=ccan diff --git a/ccan/io/test/run-05-write.c b/ccan/io/test/run-05-write.c index e878c330..5319def8 100644 --- a/ccan/io/test/run-05-write.c +++ b/ccan/io/test/run-05-write.c @@ -6,6 +6,10 @@ #include #include +#ifndef PORT +#define PORT "65005" +#endif + struct data { int state; size_t bytes; @@ -23,9 +27,9 @@ static void init_conn(int fd, struct data *d) { ok1(d->state == 0); d->state++; - if (!io_new_conn(fd, io_write(d->buf, d->bytes, io_close, d), - finish_ok, d)) - abort(); + io_set_finish(io_new_conn(fd, io_write(d->buf, d->bytes, + io_close_cb, d)), + finish_ok, d); } static int make_listen_fd(const char *port, struct addrinfo **info) @@ -94,7 +98,7 @@ int main(void) d->bytes = 1024*1024; d->buf = malloc(d->bytes); memset(d->buf, 'a', d->bytes); - fd = make_listen_fd("65005", &addrinfo); + fd = make_listen_fd(PORT, &addrinfo); ok1(fd >= 0); l = io_new_listener(fd, init_conn, d); ok1(l);