-
-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
31 changed files
with
424 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// | ||
// Copyright 2020 Staysail Systems, Inc. <[email protected]> | ||
// Copyright 2024 Staysail Systems, Inc. <[email protected]> | ||
// | ||
// This software is supplied under the terms of the MIT License, a | ||
// copy of which should be located in the distribution where this | ||
|
@@ -43,6 +43,7 @@ extern int nni_stream_listener_get_tls( | |
struct nng_stream { | ||
void (*s_free)(void *); | ||
void (*s_close)(void *); | ||
void (*s_stop)(void *); | ||
void (*s_recv)(void *, nng_aio *); | ||
void (*s_send)(void *, nng_aio *); | ||
int (*s_get)(void *, const char *, void *, size_t *, nni_type); | ||
|
@@ -53,6 +54,7 @@ struct nng_stream { | |
struct nng_stream_dialer { | ||
void (*sd_free)(void *); | ||
void (*sd_close)(void *); | ||
void (*sd_stop)(void *); | ||
void (*sd_dial)(void *, nng_aio *); | ||
int (*sd_get)(void *, const char *, void *, size_t *, nni_type); | ||
int (*sd_set)(void *, const char *, const void *, size_t, nni_type); | ||
|
@@ -65,6 +67,7 @@ struct nng_stream_dialer { | |
struct nng_stream_listener { | ||
void (*sl_free)(void *); | ||
void (*sl_close)(void *); | ||
void (*sl_stop)(void *); | ||
int (*sl_listen)(void *); | ||
void (*sl_accept)(void *, nng_aio *); | ||
int (*sl_get)(void *, const char *, void *, size_t *, nni_type); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.