aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-07-04 13:04:38 -0700
committerGarrett D'Amore <garrett@damore.org>2017-07-04 13:04:38 -0700
commit58c5fbb731f50a952864bc500a8efd3b7077ee65 (patch)
treebff20e9758e04c024ef26288dff0f4edb89cf033 /src/transport
parent5b45db0aeb1026fcf7bbdec0e6451d1cfaac58f1 (diff)
downloadnng-58c5fbb731f50a952864bc500a8efd3b7077ee65.tar.gz
nng-58c5fbb731f50a952864bc500a8efd3b7077ee65.tar.bz2
nng-58c5fbb731f50a952864bc500a8efd3b7077ee65.zip
Improved routines for list management.
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/inproc/inproc.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/transport/inproc/inproc.c b/src/transport/inproc/inproc.c
index d41e5505..b1208e25 100644
--- a/src/transport/inproc/inproc.c
+++ b/src/transport/inproc/inproc.c
@@ -234,7 +234,7 @@ nni_inproc_ep_init(void **epp, const char *url, nni_sock *sock)
ep->closed = 0;
ep->proto = nni_sock_proto(sock);
NNI_LIST_INIT(&ep->clients, nni_inproc_ep, node);
- NNI_LIST_INIT(&ep->aios, nni_aio, a_prov_node);
+ nni_aio_list_init(&ep->aios);
(void) snprintf(ep->addr, sizeof (ep->addr), "%s", url);
*epp = ep;
@@ -263,13 +263,10 @@ nni_inproc_conn_finish(nni_aio *aio, int rv)
aio->a_pipe = NULL;
}
}
+ nni_aio_list_remove(aio);
if (ep != NULL) {
- if (nni_list_active(&ep->aios, aio)) {
- nni_list_remove(&ep->aios, aio);
- }
-
if ((ep->mode != NNI_INPROC_EP_LISTEN) &&
- (nni_list_first(&ep->aios) == NULL)) {
+ nni_list_empty(&ep->aios)) {
if (nni_list_active(&ep->clients, ep)) {
nni_list_remove(&ep->clients, ep);
}
@@ -316,13 +313,10 @@ nni_inproc_connect_abort(nni_aio *aio)
nni_inproc_pipe_fini(aio->a_pipe);
aio->a_pipe = NULL;
}
+ nni_aio_list_remove(aio);
if (ep != NULL) {
- if (nni_list_active(&ep->aios, aio)) {
- nni_list_remove(&ep->aios, aio);
- }
-
if ((ep->mode != NNI_INPROC_EP_LISTEN) &&
- (nni_list_first(&ep->aios) == NULL)) {
+ nni_list_empty(&ep->aios)) {
if (nni_list_active(&ep->clients, ep)) {
nni_list_remove(&ep->clients, ep);
}
@@ -443,7 +437,7 @@ nni_inproc_ep_connect(void *arg, nni_aio *aio)
ep->mode = NNI_INPROC_EP_DIAL;
nni_list_append(&server->clients, ep);
- nni_list_append(&ep->aios, aio);
+ nni_aio_list_append(&ep->aios, aio);
nni_inproc_accept_clients(server);
nni_mtx_unlock(&nni_inproc.mx);
@@ -511,7 +505,7 @@ nni_inproc_ep_accept(void *arg, nni_aio *aio)
// Insert us into the pending server aios, and then run the
// accept list.
- nni_list_append(&ep->aios, aio);
+ nni_aio_list_append(&ep->aios, aio);
nni_inproc_accept_clients(ep);
nni_mtx_unlock(&nni_inproc.mx);
}