summaryrefslogtreecommitdiff
path: root/src/transport/zerotier
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2020-01-08 20:34:26 -0800
committerGarrett D'Amore <garrett@damore.org>2020-01-08 21:16:30 -0800
commitb21d7805523a407a14567017edbdef57ca81781f (patch)
treee07f08bdc047ee4dfb057b670766e3de5bf2f981 /src/transport/zerotier
parent8479b4c8861c77cfd9eb64e724615605bdd1cbcb (diff)
downloadnng-b21d7805523a407a14567017edbdef57ca81781f.tar.gz
nng-b21d7805523a407a14567017edbdef57ca81781f.tar.bz2
nng-b21d7805523a407a14567017edbdef57ca81781f.zip
fixes #1094 Consider in-lining task and aio
This only does it for rep, but it also has changes that should increase the overall test coverage for the REP protocol
Diffstat (limited to 'src/transport/zerotier')
-rw-r--r--src/transport/zerotier/zerotier.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/transport/zerotier/zerotier.c b/src/transport/zerotier/zerotier.c
index 027d46c2..9d166ad2 100644
--- a/src/transport/zerotier/zerotier.c
+++ b/src/transport/zerotier/zerotier.c
@@ -1327,12 +1327,12 @@ zt_wire_packet_send(ZT_Node *node, void *userptr, void *thr, int64_t socket,
return (-1);
}
- if (nni_aio_init(&aio, NULL, NULL) != 0) {
+ if (nni_aio_alloc(&aio, NULL, NULL) != 0) {
// Out of memory
return (-1);
}
if ((buf = nni_alloc(sizeof(*hdr) + len)) == NULL) {
- nni_aio_fini(aio);
+ nni_aio_free(aio);
return (-1);
}
@@ -1359,7 +1359,7 @@ zt_wire_packet_send(ZT_Node *node, void *userptr, void *thr, int64_t socket,
// care which. (There may be a few thread context switches, but
// none of them are going to have to wait for some unbounded time.)
nni_aio_wait(aio);
- nni_aio_fini(aio);
+ nni_aio_free(aio);
nni_free(hdr, hdr->len + sizeof(*hdr));
return (0);
@@ -1406,8 +1406,8 @@ zt_node_destroy(zt_node *ztn)
if (ztn->zn_flock != NULL) {
nni_file_unlock(ztn->zn_flock);
}
- nni_aio_fini(ztn->zn_rcv4_aio);
- nni_aio_fini(ztn->zn_rcv6_aio);
+ nni_aio_free(ztn->zn_rcv4_aio);
+ nni_aio_free(ztn->zn_rcv6_aio);
nni_idhash_fini(ztn->zn_eps);
nni_idhash_fini(ztn->zn_lpipes);
nni_idhash_fini(ztn->zn_rpipes);
@@ -1440,8 +1440,8 @@ zt_node_create(zt_node **ztnp, const char *path)
NNI_LIST_INIT(&ztn->zn_eplist, zt_ep, ze_link);
NNI_LIST_INIT(&ztn->zn_plist, zt_pipe, zp_link);
nni_cv_init(&ztn->zn_bgcv, &zt_lk);
- nni_aio_init(&ztn->zn_rcv4_aio, zt_node_rcv4_cb, ztn);
- nni_aio_init(&ztn->zn_rcv6_aio, zt_node_rcv6_cb, ztn);
+ nni_aio_alloc(&ztn->zn_rcv4_aio, zt_node_rcv4_cb, ztn);
+ nni_aio_alloc(&ztn->zn_rcv6_aio, zt_node_rcv6_cb, ztn);
if (((ztn->zn_rcv4_buf = nni_alloc(zt_rcv_bufsize)) == NULL) ||
((ztn->zn_rcv6_buf = nni_alloc(zt_rcv_bufsize)) == NULL)) {
@@ -1642,7 +1642,7 @@ zt_pipe_fini(void *arg)
zt_pipe *p = arg;
zt_node *ztn = p->zp_ztn;
- nni_aio_fini(p->zp_ping_aio);
+ nni_aio_free(p->zp_ping_aio);
// This tosses the connection details and all state.
nni_mtx_lock(&zt_lk);
@@ -1705,7 +1705,7 @@ zt_pipe_alloc(
rv = nni_idhash_insert(ztn->zn_lpipes, laddr, p);
}
if ((rv != 0) ||
- ((rv = nni_aio_init(&p->zp_ping_aio, zt_pipe_ping_cb, p)) != 0)) {
+ ((rv = nni_aio_alloc(&p->zp_ping_aio, zt_pipe_ping_cb, p)) != 0)) {
zt_pipe_reap(p);
return (rv);
}
@@ -2078,7 +2078,7 @@ zt_ep_fini(void *arg)
{
zt_ep *ep = arg;
nni_aio_stop(ep->ze_creq_aio);
- nni_aio_fini(ep->ze_creq_aio);
+ nni_aio_free(ep->ze_creq_aio);
NNI_FREE_STRUCT(ep);
}
@@ -2154,7 +2154,7 @@ zt_ep_init(void **epp, nni_url *url, nni_sock *sock, nni_dialer *ndialer,
nni_aio_list_init(&ep->ze_aios);
- rv = nni_aio_init(&ep->ze_creq_aio, zt_ep_conn_req_cb, ep);
+ rv = nni_aio_alloc(&ep->ze_creq_aio, zt_ep_conn_req_cb, ep);
if (rv != 0) {
zt_ep_fini(ep);
return (rv);