diff options
| author | Garrett D'Amore <garrett@damore.org> | 2018-05-15 11:59:09 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2018-05-15 11:59:09 -0700 |
| commit | 81808ce3d38cc7ce0131367e2187f0beb2cd1b43 (patch) | |
| tree | 8bc5652bcc0670f48b78c4f344522597875d8eb2 /src/core/transport.h | |
| parent | 1d033484ee1a2ec26d3eead073e7bc0f889ffdf4 (diff) | |
| download | nng-81808ce3d38cc7ce0131367e2187f0beb2cd1b43.tar.gz nng-81808ce3d38cc7ce0131367e2187f0beb2cd1b43.tar.bz2 nng-81808ce3d38cc7ce0131367e2187f0beb2cd1b43.zip | |
fixes #431 hang in taskq_wait
fixes #429 async websocket reap leads to crash
This tightens up the code for shutdown, ensuring that transport
callbacks are completely stopped before advancing to the next step
of teardown of transport pipes or endpoints.
It also fixes a problem where task_wait would sometimes get "stuck"
as tasks transitioned between asynch and synchronous completions.
Finally, it saves a few cycles by only calling a cancellation callback
once during cancellation of an aio.
Diffstat (limited to 'src/core/transport.h')
| -rw-r--r-- | src/core/transport.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/transport.h b/src/core/transport.h index 96976efd..d37fb449 100644 --- a/src/core/transport.h +++ b/src/core/transport.h @@ -102,9 +102,13 @@ struct nni_tran_ep_ops { void (*ep_accept)(void *, nni_aio *); // ep_close stops the endpoint from operating altogether. It does - // not affect pipes that have already been created. + // not affect pipes that have already been created. It is nonblocking. void (*ep_close)(void *); + // ep_stop stops the endpoint, and *waits* for any outstanding + // aio operations to complete. + void (*ep_stop)(void *); + // ep_options is an array of endpoint options. The final element must // have a NULL name. If this member is NULL, then no transport specific // options are available. @@ -142,6 +146,11 @@ struct nni_tran_pipe_ops { // its readiness by finishing the aio. void (*p_start)(void *, nni_aio *); + // p_stop stops the pipe, waiting for any callbacks that are + // outstanding to complete. This is done before tearing down + // resources with p_fini. + void (*p_stop)(void *); + // p_aio_send queues the message for transmit. If this fails, then // the caller may try again with the same message (or free it). If // the call succeeds, then the transport has taken ownership of the |
