From b4d3ff2d460607ba8e1b351233cb6cbe9f031264 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Sun, 29 Dec 2019 14:39:27 -0800 Subject: fixes #1064 Potential deadlock in statistics code fixes #1063 Include sanitizer runs in CI fixes #1068 Wssfile test sometimes fails with wrong error code While here, addressed a number of clang-tidy items, and some light cleanup of code we were already in. --- src/supplemental/websocket/websocket.h | 2 +- src/supplemental/websocket/wssfile_test.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'src/supplemental/websocket') diff --git a/src/supplemental/websocket/websocket.h b/src/supplemental/websocket/websocket.h index bbc58d30..1ecb4618 100644 --- a/src/supplemental/websocket/websocket.h +++ b/src/supplemental/websocket/websocket.h @@ -29,7 +29,7 @@ typedef struct nni_ws_dialer nni_ws_dialer; // on INADDR_ANY port 80, with path "/". For connect side, INADDR_ANY // makes no sense. (TBD: return NNG_EADDRINVAL, or try loopback?) -// Much of the websocket API is still "private", meeaning you should not +// Much of the websocket API is still "private", meaning you should not // rely upon it being around. extern int nni_ws_listener_alloc(nng_stream_listener **, const nni_url *); extern int nni_ws_dialer_alloc(nng_stream_dialer **, const nni_url *); diff --git a/src/supplemental/websocket/wssfile_test.c b/src/supplemental/websocket/wssfile_test.c index f55a9e84..b678ddb0 100644 --- a/src/supplemental/websocket/wssfile_test.c +++ b/src/supplemental/websocket/wssfile_test.c @@ -257,7 +257,16 @@ test_invalid_verify(void) TEST_NNG_PASS(nng_setopt_int( s2, NNG_OPT_TLS_AUTH_MODE, NNG_TLS_AUTH_MODE_REQUIRED)); - TEST_NNG_FAIL(nng_dial(s2, addr, NULL, 0), NNG_EPEERAUTH); + // We find that sometimes this fails due to NNG_EPEERAUTH, but it + // can also fail due to NNG_ECLOSED. This seems to be timing + // dependent, based on receive vs. send timing most likely. + // Applications shouldn't really depend that much on this. + int rv; + rv = nng_dial(s2, addr, NULL, 0); + TEST_CHECK(rv != 0); + TEST_CHECK_((rv == NNG_EPEERAUTH) || (rv == NNG_ECLOSED) || + (rv == NNG_ECRYPTO), + "result from dial: %d %s", rv, nng_strerror(rv)); TEST_NNG_PASS(nng_close(s1)); TEST_NNG_PASS(nng_close(s2)); @@ -309,6 +318,7 @@ test_no_verify(void) TEST_NNG_PASS(nng_pipe_getopt_bool(p, NNG_OPT_TLS_VERIFIED, &b)); TEST_CHECK(b == false); + nng_msg_free(msg); TEST_NNG_PASS(nng_close(s1)); TEST_NNG_PASS(nng_close(s2)); } @@ -356,6 +366,7 @@ test_verify_works(void) TEST_NNG_PASS(nng_pipe_getopt_bool(p, NNG_OPT_TLS_VERIFIED, &b)); TEST_CHECK(b == true); + nng_msg_free(msg); TEST_NNG_PASS(nng_close(s1)); TEST_NNG_PASS(nng_close(s2)); } -- cgit v1.2.3-70-g09d2