diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-07-31 12:33:58 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-08-05 18:45:04 +0300 |
| commit | d7f7c896c0ede24249ef63b1e45b1878bf4bd473 (patch) | |
| tree | 32eece7d91a648f24cb174096fb9667cab978f37 /src/core/aio.c | |
| parent | ccc24a8e508131a2226474642a038baaa2cbcc8c (diff) | |
| download | nng-d7f7c896c0ede24249ef63b1e45b1878bf4bd473.tar.gz nng-d7f7c896c0ede24249ef63b1e45b1878bf4bd473.tar.bz2 nng-d7f7c896c0ede24249ef63b1e45b1878bf4bd473.zip | |
fixes #599 nng_dial sync should not return until added to socket
fixes #208 pipe start should occur before connect / accept
fixes #616 Race condition closing between header & body
This refactors the transports to handle their own connection
handshaking before passing the pipe to the socket. This
changes and simplifies the setup. This also fixes a rather
challenging race condition described by #616.
Diffstat (limited to 'src/core/aio.c')
| -rw-r--r-- | src/core/aio.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/aio.c b/src/core/aio.c index 40638bce..294a0b92 100644 --- a/src/core/aio.c +++ b/src/core/aio.c @@ -217,11 +217,17 @@ void nni_aio_stop(nni_aio *aio) { if (aio != NULL) { + nni_aio_cancelfn cancelfn; + nni_mtx_lock(&nni_aio_lk); - aio->a_stop = true; + cancelfn = aio->a_prov_cancel; + aio->a_prov_cancel = NULL; + aio->a_stop = true; nni_mtx_unlock(&nni_aio_lk); - nni_aio_abort(aio, NNG_ECANCELED); + if (cancelfn != NULL) { + cancelfn(aio, NNG_ECANCELED); + } nni_aio_wait(aio); } |
