diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-10-03 12:57:04 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-10-03 12:57:04 -0700 |
| commit | 557964482f2b9d4246a2943fb1bedc6074d01e0d (patch) | |
| tree | 323d8ca977e9d25aa827dc9e272e84630adb8c3e | |
| parent | 6fef4c1e5bf73ad76e7cdcfb65540f1308045339 (diff) | |
| download | nng-557964482f2b9d4246a2943fb1bedc6074d01e0d.tar.gz nng-557964482f2b9d4246a2943fb1bedc6074d01e0d.tar.bz2 nng-557964482f2b9d4246a2943fb1bedc6074d01e0d.zip | |
fixes #99 Still seeing segfaults in pair1 (rarely)
| -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 |
