aboutsummaryrefslogtreecommitdiff
path: root/src/transport/zerotier
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-02-08 14:16:23 -0800
committerGarrett D'Amore <garrett@damore.org>2018-02-08 18:54:09 -0800
commitd606317f5c028fa8fba5d5384b0ccd90ffa4eab5 (patch)
tree3a6a70f6f2dc81b8722134752716f1c58bd1825c /src/transport/zerotier
parente9efefca683b244b40f831c554d7c72a745b8372 (diff)
downloadnng-d606317f5c028fa8fba5d5384b0ccd90ffa4eab5.tar.gz
nng-d606317f5c028fa8fba5d5384b0ccd90ffa4eab5.tar.bz2
nng-d606317f5c028fa8fba5d5384b0ccd90ffa4eab5.zip
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.
Diffstat (limited to 'src/transport/zerotier')
-rw-r--r--src/transport/zerotier/zerotier.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/transport/zerotier/zerotier.c b/src/transport/zerotier/zerotier.c
index d6762d25..6dddbb9a 100644
--- a/src/transport/zerotier/zerotier.c
+++ b/src/transport/zerotier/zerotier.c
@@ -690,7 +690,8 @@ zt_ep_recv_conn_ack(zt_ep *ep, uint64_t raddr, const uint8_t *data, size_t len)
nni_idhash_remove(ztn->zn_eps, ep->ze_laddr);
ep->ze_laddr = 0;
- nni_aio_finish_pipe(aio, p);
+ nni_aio_set_output(aio, 0, p);
+ nni_aio_finish(aio, 0, 0);
}
static void
@@ -2351,7 +2352,8 @@ zt_ep_doaccept(zt_ep *ep)
}
p->zp_peer = creq.cr_proto;
zt_pipe_send_conn_ack(p);
- nni_aio_finish_pipe(aio, p);
+ nni_aio_set_output(aio, 0, p);
+ nni_aio_finish(aio, 0, 0);
}
}
@@ -2398,14 +2400,16 @@ zt_ep_conn_req_cb(void *arg)
ep->ze_creq_active = 0;
switch ((rv = nni_aio_result(aio))) {
case 0:
+ p = nni_aio_get_output(aio, 0);
// Already canceled, or already handled?
if ((uaio = nni_list_first(&ep->ze_aios)) != NULL) {
nni_aio_list_remove(uaio);
- nni_aio_finish_pipe(uaio, nni_aio_get_pipe(aio));
+ nni_aio_set_output(uaio, 0, p);
+ nni_aio_finish(uaio, 0, 0);
} else {
// We have a pipe, but nowhere to stick it.
// Just discard it.
- zt_pipe_fini(nni_aio_get_pipe(aio));
+ zt_pipe_fini(p);
}
ep->ze_creq_try = 0;
break;