aboutsummaryrefslogtreecommitdiff
path: root/src/supplemental/websocket
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2019-12-29 14:39:27 -0800
committerGarrett D'Amore <garrett@damore.org>2019-12-29 15:21:42 -0800
commitb4d3ff2d460607ba8e1b351233cb6cbe9f031264 (patch)
tree74a9aba0717f74404438bbca1bdc75a9e6105abf /src/supplemental/websocket
parente457590015f8c3f4e840e4bed290f052c001e07c (diff)
downloadnng-b4d3ff2d460607ba8e1b351233cb6cbe9f031264.tar.gz
nng-b4d3ff2d460607ba8e1b351233cb6cbe9f031264.tar.bz2
nng-b4d3ff2d460607ba8e1b351233cb6cbe9f031264.zip
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.
Diffstat (limited to 'src/supplemental/websocket')
-rw-r--r--src/supplemental/websocket/websocket.h2
-rw-r--r--src/supplemental/websocket/wssfile_test.c13
2 files changed, 13 insertions, 2 deletions
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));
}