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. --- src/supplemental/http/http_client.c | 2 +- src/supplemental/http/http_public.c | 2 +- src/supplemental/http/http_server.c | 2 +- src/supplemental/websocket/websocket.c | 9 ++++++--- 4 files changed, 9 insertions(+), 6 deletions(-) (limited to 'src/supplemental') diff --git a/src/supplemental/http/http_client.c b/src/supplemental/http/http_client.c index 918b7b09..9058b6e2 100644 --- a/src/supplemental/http/http_client.c +++ b/src/supplemental/http/http_client.c @@ -44,7 +44,7 @@ http_conn_done(void *arg) nni_mtx_lock(&c->mtx); rv = nni_aio_result(c->connaio); - p = rv == 0 ? nni_aio_get_pipe(c->connaio) : NULL; + p = rv == 0 ? nni_aio_get_output(c->connaio, 0) : NULL; if ((aio = nni_list_first(&c->aios)) == NULL) { if (p != NULL) { nni_plat_tcp_pipe_fini(p); diff --git a/src/supplemental/http/http_public.c b/src/supplemental/http/http_public.c index 9d23ed8e..5437a000 100644 --- a/src/supplemental/http/http_public.c +++ b/src/supplemental/http/http_public.c @@ -737,7 +737,7 @@ void nng_http_client_connect(nng_http_client *cli, nng_aio *aio) { #ifdef NNG_SUPP_HTTP - return (nni_http_client_connect(cli, aio)); + nni_http_client_connect(cli, aio); #else NNI_ARG_UNUSED(cli); if (nni_aio_start(aio, NULL, NULL)) { diff --git a/src/supplemental/http/http_server.c b/src/supplemental/http/http_server.c index 4a426c8c..4c89708d 100644 --- a/src/supplemental/http/http_server.c +++ b/src/supplemental/http/http_server.c @@ -719,7 +719,7 @@ http_server_acccb(void *arg) nni_mtx_unlock(&s->mtx); return; } - tcp = nni_aio_get_pipe(aio); + tcp = nni_aio_get_output(aio, 0); if (s->closed) { // If we're closing, then reject this one. nni_plat_tcp_pipe_fini(tcp); diff --git a/src/supplemental/websocket/websocket.c b/src/supplemental/websocket/websocket.c index ad4ce196..05a2c62c 100644 --- a/src/supplemental/websocket/websocket.c +++ b/src/supplemental/websocket/websocket.c @@ -1174,7 +1174,8 @@ ws_http_cb_listener(nni_ws *ws, nni_aio *aio) ws->ready = true; if ((aio = nni_list_first(&l->aios)) != NULL) { nni_list_remove(&l->aios, aio); - nni_aio_finish_pipe(aio, ws); + nni_aio_set_output(aio, 0, ws); + nni_aio_finish(aio, 0, 0); } else { nni_list_append(&l->pend, ws); } @@ -1269,7 +1270,8 @@ ws_http_cb_dialer(nni_ws *ws, nni_aio *aio) nni_list_remove(&d->wspend, ws); ws->ready = true; ws->useraio = NULL; - nni_aio_finish_pipe(uaio, ws); + nni_aio_set_output(uaio, 0, ws); + nni_aio_finish(uaio, 0, 0); nni_mtx_unlock(&d->mtx); return; err: @@ -1621,7 +1623,8 @@ nni_ws_listener_accept(nni_ws_listener *l, nni_aio *aio) } if ((ws = nni_list_first(&l->pend)) != NULL) { nni_list_remove(&l->pend, ws); - nni_aio_finish_pipe(aio, ws); + nni_aio_set_output(aio, 0, ws); + nni_aio_finish(aio, 0, 0); } else { nni_list_append(&l->aios, aio); } -- cgit v1.2.3-70-g09d2