aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2018-05-01 15:17:09 -0700
committerGarrett D'Amore <garrett@damore.org>2018-05-01 15:17:09 -0700
commit1ef281a7fbd544c6d3384fd8a71d10dc4bb081e8 (patch)
treea8299e2452d82cdeb624f3787ffb22eec4ecbc62 /src
parent4998964a435fe0f02a2d81b01fdb837214674e72 (diff)
downloadnng-1ef281a7fbd544c6d3384fd8a71d10dc4bb081e8.tar.gz
nng-1ef281a7fbd544c6d3384fd8a71d10dc4bb081e8.tar.bz2
nng-1ef281a7fbd544c6d3384fd8a71d10dc4bb081e8.zip
Some very minor pipe implementation cleanups.
We already closed the pipe before putting it on the reaplist, so don't do it again.
Diffstat (limited to 'src')
-rw-r--r--src/core/pipe.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core/pipe.c b/src/core/pipe.c
index c619fca0..f849e00e 100644
--- a/src/core/pipe.c
+++ b/src/core/pipe.c
@@ -27,7 +27,7 @@ struct nni_pipe {
nni_sock * p_sock;
nni_ep * p_ep;
bool p_reap;
- int p_stop;
+ bool p_stop;
int p_refcnt;
nni_mtx p_mtx;
nni_cv p_cv;
@@ -218,7 +218,7 @@ nni_pipe_stop(nni_pipe *p)
nni_mtx_unlock(&p->p_mtx);
return;
}
- p->p_stop = 1;
+ p->p_stop = true;
nni_mtx_unlock(&p->p_mtx);
// Put it on the reaplist for async cleanup
@@ -239,14 +239,13 @@ nni_pipe_start_cb(void *arg)
{
nni_pipe *p = arg;
nni_aio * aio = p->p_start_aio;
- int rv;
- if ((rv = nni_aio_result(aio)) != 0) {
+ if (nni_aio_result(aio) != 0) {
nni_pipe_stop(p);
return;
}
- if ((rv = nni_sock_pipe_start(p->p_sock, p)) != 0) {
+ if (nni_sock_pipe_start(p->p_sock, p) != 0) {
nni_pipe_stop(p);
}
}
@@ -272,6 +271,8 @@ nni_pipe_create(nni_ep *ep, void *tdata)
p->p_ep = ep;
p->p_sock = sock;
p->p_reap = false;
+ p->p_stop = false;
+ p->p_refcnt = 0;
NNI_LIST_NODE_INIT(&p->p_reap_node);
NNI_LIST_NODE_INIT(&p->p_sock_node);
@@ -354,9 +355,6 @@ nni_pipe_reaper(void *notused)
nni_list_remove(&nni_pipe_reap_list, p);
nni_mtx_unlock(&nni_pipe_reap_lk);
- // Transport close...
- nni_pipe_close(p);
-
nni_pipe_destroy(p);
nni_mtx_lock(&nni_pipe_reap_lk);
continue;