diff options
| author | Garrett D'Amore <garrett@damore.org> | 2017-07-15 16:56:14 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2017-07-15 16:56:14 -0700 |
| commit | bef8ea546a7efd2726f51207e26eafc75979573d (patch) | |
| tree | 8de61dc91e5b125dc569a7dc5585d66051ff5496 | |
| parent | 0d48c9d4f359ec79f9cc10db3e0e04cb7a58623e (diff) | |
| download | nng-bef8ea546a7efd2726f51207e26eafc75979573d.tar.gz nng-bef8ea546a7efd2726f51207e26eafc75979573d.tar.bz2 nng-bef8ea546a7efd2726f51207e26eafc75979573d.zip | |
IPC race condition fixes. These mirror what we did for TCP.
| -rw-r--r-- | src/transport/ipc/ipc.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/transport/ipc/ipc.c b/src/transport/ipc/ipc.c index a019dfbc..b799dba1 100644 --- a/src/transport/ipc/ipc.c +++ b/src/transport/ipc/ipc.c @@ -143,11 +143,10 @@ nni_ipc_cancel_start(nni_aio *aio) nni_ipc_pipe *pipe = aio->a_prov_data; nni_mtx_lock(&pipe->mtx); - if ((aio = pipe->user_negaio) != NULL) { - pipe->user_negaio = NULL; - nni_aio_stop(aio); - } + pipe->user_negaio = NULL; nni_mtx_unlock(&pipe->mtx); + + nni_aio_cancel(&pipe->negaio, aio->a_result); } static void @@ -325,8 +324,7 @@ nni_ipc_cancel_tx(nni_aio *aio) pipe->user_txaio = NULL; nni_mtx_unlock(&pipe->mtx); - // stop the underlying aio ... we don't want a result for it. - nni_aio_stop(&pipe->txaio); + nni_aio_cancel(&pipe->txaio, aio->a_result); } static void @@ -370,8 +368,7 @@ nni_ipc_cancel_rx(nni_aio *aio) pipe->user_rxaio = NULL; nni_mtx_unlock(&pipe->mtx); - // stop the underlying aio ... we don't want a result for it. - nni_aio_stop(&pipe->rxaio); + nni_aio_cancel(&pipe->rxaio, aio->a_result); } static void @@ -573,11 +570,10 @@ nni_ipc_cancel_ep(nni_aio *aio) nni_ipc_ep *ep = aio->a_prov_data; nni_mtx_lock(&ep->mtx); - if (ep->user_aio == aio) { - ep->user_aio = NULL; - } - nni_aio_stop(&ep->aio); + ep->user_aio = NULL; nni_mtx_unlock(&ep->mtx); + + nni_aio_cancel(&ep->aio, aio->a_result); } static void |
