diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/socket.c | 14 | ||||
| -rw-r--r-- | src/protocol/pair/pair_v0.c | 8 | ||||
| -rw-r--r-- | src/protocol/pair/pair_v1.c | 8 |
3 files changed, 14 insertions, 16 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index e1cb1294..d613ac0e 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -341,22 +341,20 @@ nni_sock_pipe_remove(nni_sock *sock, nni_pipe *pipe) { void *pdata; + nni_mtx_lock(&sock->s_mx); pdata = nni_pipe_get_proto_data(pipe); - if (pdata != NULL) { - nni_mtx_lock(&sock->s_mx); sock->s_pipe_ops.pipe_stop(pdata); + nni_pipe_set_proto_data(pipe, NULL); if (nni_list_active(&sock->s_pipes, pipe)) { nni_list_remove(&sock->s_pipes, pipe); - if (sock->s_closing && - nni_list_empty(&sock->s_pipes)) { - nni_cv_wake(&sock->s_cv); - } } sock->s_pipe_ops.pipe_fini(pdata); - nni_pipe_set_proto_data(pipe, NULL); - nni_mtx_unlock(&sock->s_mx); } + if (sock->s_closing && nni_list_empty(&sock->s_pipes)) { + nni_cv_wake(&sock->s_cv); + } + nni_mtx_unlock(&sock->s_mx); } void diff --git a/src/protocol/pair/pair_v0.c b/src/protocol/pair/pair_v0.c index 9cabe3c7..a87af593 100644 --- a/src/protocol/pair/pair_v0.c +++ b/src/protocol/pair/pair_v0.c @@ -139,10 +139,10 @@ pair0_pipe_stop(void *arg) pair0_pipe *p = arg; pair0_sock *s = p->psock; - nni_aio_cancel(p->aio_send, NNG_ECANCELED); - nni_aio_cancel(p->aio_recv, NNG_ECANCELED); - nni_aio_cancel(p->aio_putq, NNG_ECANCELED); - nni_aio_cancel(p->aio_getq, NNG_ECANCELED); + nni_aio_stop(p->aio_send); + nni_aio_stop(p->aio_recv); + nni_aio_stop(p->aio_putq); + nni_aio_stop(p->aio_getq); nni_mtx_lock(&s->mtx); if (s->ppipe == p) { diff --git a/src/protocol/pair/pair_v1.c b/src/protocol/pair/pair_v1.c index 0b9e0643..a27203b2 100644 --- a/src/protocol/pair/pair_v1.c +++ b/src/protocol/pair/pair_v1.c @@ -191,10 +191,10 @@ pair1_pipe_stop(void *arg) nni_mtx_unlock(&s->mtx); nni_msgq_close(p->sendq); - nni_aio_cancel(p->aio_send, NNG_ECANCELED); - nni_aio_cancel(p->aio_recv, NNG_ECANCELED); - nni_aio_cancel(p->aio_putq, NNG_ECANCELED); - nni_aio_cancel(p->aio_getq, NNG_ECANCELED); + nni_aio_stop(p->aio_send); + nni_aio_stop(p->aio_recv); + nni_aio_stop(p->aio_putq); + nni_aio_stop(p->aio_getq); } static void |
