From d72076207a2fad96ff014a81366868fb47a0ed1b Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 31 Aug 2017 17:59:01 -0700 Subject: Allocate AIOs dynamically. We allocate AIO structures dynamically, so that we can use them abstractly in more places without inlining them. This will be used for the ZeroTier transport to allow us to create operations consisting of just the AIO. Furthermore, we provide accessors for some of the aio members, in the hopes that we will be able to wrap these for "safe" version of the AIO capability to export to applications, and to protocol and transport implementors. While here we cleaned up the protocol details to use consistently shorter names (no nni_ prefix for static symbols needed), and we also fixed a bug in the surveyor code. --- src/core/pipe.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/core/pipe.c') diff --git a/src/core/pipe.c b/src/core/pipe.c index 0c024c66..0670ed01 100644 --- a/src/core/pipe.c +++ b/src/core/pipe.c @@ -30,7 +30,7 @@ struct nni_pipe { nni_mtx p_mtx; nni_cv p_cv; nni_list_node p_reap_node; - nni_aio p_start_aio; + nni_aio * p_start_aio; }; static nni_idhash *nni_pipes; @@ -99,7 +99,7 @@ nni_pipe_destroy(nni_pipe *p) } // Stop any pending negotiation. - nni_aio_stop(&p->p_start_aio); + nni_aio_stop(p->p_start_aio); // Make sure any unlocked holders are done with this. // This happens during initialization for example. @@ -112,7 +112,7 @@ nni_pipe_destroy(nni_pipe *p) // We have exclusive access at this point, so we can check if // we are still on any lists. - nni_aio_fini(&p->p_start_aio); + nni_aio_fini(p->p_start_aio); if (nni_list_node_active(&p->p_ep_node)) { nni_ep_pipe_remove(p->p_ep, p); @@ -172,7 +172,7 @@ nni_pipe_close(nni_pipe *p) nni_mtx_unlock(&p->p_mtx); // abort any pending negotiation/start process. - nni_aio_cancel(&p->p_start_aio, NNG_ECLOSED); + nni_aio_cancel(p->p_start_aio, NNG_ECLOSED); } void @@ -205,7 +205,7 @@ static void nni_pipe_start_cb(void *arg) { nni_pipe *p = arg; - nni_aio * aio = &p->p_start_aio; + nni_aio * aio = p->p_start_aio; int rv; if ((rv = nni_aio_result(aio)) != 0) { @@ -270,9 +270,9 @@ void nni_pipe_start(nni_pipe *p) { if (p->p_tran_ops.p_start == NULL) { - nni_aio_finish(&p->p_start_aio, 0, 0); + nni_aio_finish(p->p_start_aio, 0, 0); } else { - p->p_tran_ops.p_start(p->p_tran_data, &p->p_start_aio); + p->p_tran_ops.p_start(p->p_tran_data, p->p_start_aio); } } -- cgit v1.2.3-70-g09d2