diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-08-31 17:59:01 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-09-22 11:47:07 -0700 |
| commit | d72076207a2fad96ff014a81366868fb47a0ed1b (patch) | |
| tree | 5a4f67ab607ef6690e983c2d1ab2c64062027e52 /src/core/pipe.c | |
| parent | 366f3e5d14c5f891655ad1fa2b3cfa9a56b8830d (diff) | |
| download | nng-d72076207a2fad96ff014a81366868fb47a0ed1b.tar.gz nng-d72076207a2fad96ff014a81366868fb47a0ed1b.tar.bz2 nng-d72076207a2fad96ff014a81366868fb47a0ed1b.zip | |
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.
Diffstat (limited to 'src/core/pipe.c')
| -rw-r--r-- | src/core/pipe.c | 14 |
1 files changed, 7 insertions, 7 deletions
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); } } |
