From 81f5d3c6268ff91ee9c36c4cb34f6f9bfd54740d Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 12 Dec 2024 17:55:48 -0800 Subject: streams: add explicit stop functions This allows us to explicitly stop streams, dialers, and listeners, before we start tearing down things. This hopefully will be useful in resolving use-after-free bugs in http, tls, and websockets. The new functions are not yet documented, but they are nng_stream_stop, nng_stream_dialer_stop, and nng_stream_listener_stop. They should be called after close, and before free. The close functions now close without blocking, but the stop function is allowed to block. --- src/supplemental/http/http_server.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/supplemental/http/http_server.c') diff --git a/src/supplemental/http/http_server.c b/src/supplemental/http/http_server.c index 2240492f..0d5d9cb0 100644 --- a/src/supplemental/http/http_server.c +++ b/src/supplemental/http/http_server.c @@ -895,6 +895,7 @@ http_server_fini(nni_http_server *s) http_error *epage; nni_aio_stop(s->accaio); + nng_stream_listener_stop(s->listener); nni_mtx_lock(&s->mtx); NNI_ASSERT(nni_list_empty(&s->conns)); -- cgit v1.2.3-70-g09d2