diff options
| author | Garrett D'Amore <garrett@damore.org> | 2019-12-30 14:18:35 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2019-12-31 11:29:47 -0800 |
| commit | 092a24eea6ae494be8f7a5fe543e634cca01022e (patch) | |
| tree | 8579884b571773c65efde3edecf3b2289697798b /src/core | |
| parent | b4d3ff2d460607ba8e1b351233cb6cbe9f031264 (diff) | |
| download | nng-092a24eea6ae494be8f7a5fe543e634cca01022e.tar.gz nng-092a24eea6ae494be8f7a5fe543e634cca01022e.tar.bz2 nng-092a24eea6ae494be8f7a5fe543e634cca01022e.zip | |
fixes #1075 WebSocket heap use after free
This also introduces a new atomic boolean type, so we can use that
to trigger whether we've added the HTTP handler or not.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/platform.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/platform.h b/src/core/platform.h index b1d76899..b56f9a68 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -169,6 +169,15 @@ typedef struct nni_atomic_flag nni_atomic_flag; extern bool nni_atomic_flag_test_and_set(nni_atomic_flag *); extern void nni_atomic_flag_reset(nni_atomic_flag *); +// nni_atomic_bool is for boolean flags that need to be checked without +// changing their value. This might require a lock on some systems. +typedef struct nni_atomic_bool nni_atomic_bool; + +extern void nni_atomic_init_bool(nni_atomic_bool *); +extern void nni_atomic_set_bool(nni_atomic_bool *, bool); +extern bool nni_atomic_get_bool(nni_atomic_bool *); +extern bool nni_atomic_swap_bool(nni_atomic_bool *, bool); + typedef struct nni_atomic_u64 nni_atomic_u64; extern void nni_atomic_init64(nni_atomic_u64 *); |
