From d606317f5c028fa8fba5d5384b0ccd90ffa4eab5 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 8 Feb 2018 14:16:23 -0800 Subject: fixes #171 Refactor aio to use generic data fields This addresses the use of the pipe special field, and eliminates it. The message APIs (recvmsg, sendmsg) need to be updated as well still, but I want to handle that as part of a separate issue. While here we fixed various compiler warnings, etc. --- tests/httpserver.c | 2 +- tests/resolv.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/httpserver.c b/tests/httpserver.c index a62bae25..bbdd8423 100644 --- a/tests/httpserver.c +++ b/tests/httpserver.c @@ -200,7 +200,7 @@ TestMain("HTTP Server", { nng_aio_wait(aio); So(nng_aio_result(aio) == 0); - h = nni_aio_get_output(aio, 0); + h = nng_aio_get_output(aio, 0); So(h != NULL); So(nng_http_req_alloc(&req, url) == 0); So(nng_http_res_alloc(&res) == 0); diff --git a/tests/resolv.c b/tests/resolv.c index 607b3b11..9d83e6df 100644 --- a/tests/resolv.c +++ b/tests/resolv.c @@ -52,20 +52,20 @@ ip6tostr(void *addr) // the normal assumptions on Linux do *not* hold true. #if 0 Convey("Localhost IPv6 resolves", { - nni_aio aio; - memset(&aio, 0, sizeof (aio)); + nng_aio *aio; const char *str; - nni_aio_init(&aio, NULL, NULL); + nng_sockaddr sa; + So(nng_aio_alloc(&aio, NULL, NULL) == 0); + So(nng_aio_set_input(aio, 0, &sa) == 0); nni_plat_tcp_resolv("localhost", "80", NNG_AF_INET6, 1, - &aio); - nni_aio_wait(&aio); - So(nni_aio_result(&aio) == 0); - So(aio.a_naddrs == 1); - So(aio.a_addrs[0].s_un.s_in6.sa_family == NNG_AF_INET6); - So(aio.a_addrs[0].s_un.s_in6.sa_port == ntohs(80)); - str = ip6tostr(&aio.a_addrs[0].s_un.s_in6.sa_addr); + aio); + nng_aio_wait(aio); + So(nng_aio_result(aio) == 0); + So(sa.s_un.s_in6.sa_family == NNG_AF_INET6); + So(sa.s_un.s_in6.sa_port == ntohs(80)); + str = ip6tostr(&sa.s_un.s_in6.sa_addr); So(strcmp(str, "::1") == 0); - nni_aio_fini(&aio); + nng_aio_free(aio); } #endif -- cgit v1.2.3-70-g09d2