From aa3bb50aeca3b7350a41f0538817c49d9656d207 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 28 Dec 2017 16:02:53 -0800 Subject: Fix compilation warnings, bugs, and crashes found on Windows. This addresses a number of problems that were found on Windows, including one bug that actually turned up in testing on POSIX. --- tests/httpclient.c | 12 +++++------- tests/ws.c | 1 + tests/zt.c | 8 ++------ 3 files changed, 8 insertions(+), 13 deletions(-) (limited to 'tests') diff --git a/tests/httpclient.c b/tests/httpclient.c index ab4f46a2..6ea6fa6e 100644 --- a/tests/httpclient.c +++ b/tests/httpclient.c @@ -30,13 +30,11 @@ TestMain("HTTP Client", { atexit(nng_fini); Convey("Given a TCP connection to httpbin.org", { - nni_plat_tcp_ep * ep; - nni_plat_tcp_pipe *p; - nng_aio * aio; - nni_aio * iaio; - nng_sockaddr rsa; - nni_http_client * cli; - nni_http * http; + nng_aio * aio; + nni_aio * iaio; + nng_sockaddr rsa; + nni_http_client *cli; + nni_http * http; So(nng_aio_alloc(&aio, NULL, NULL) == 0); iaio = (nni_aio *) aio; diff --git a/tests/ws.c b/tests/ws.c index 71836390..aa2ba56e 100644 --- a/tests/ws.c +++ b/tests/ws.c @@ -104,6 +104,7 @@ TestMain("WebSocket Transport", { }); trantest_next_address(addr, "ws://*:%u/test"); So(nng_listen(s1, addr, NULL, 0) == 0); + nng_msleep(100); // reset port back one trantest_prev_address(addr, "ws://127.0.0.1:%u/test"); So(nng_dial(s2, addr, NULL, 0) == 0); diff --git a/tests/zt.c b/tests/zt.c index bf423df0..52f535c9 100644 --- a/tests/zt.c +++ b/tests/zt.c @@ -32,6 +32,7 @@ int mkdir(const char *path, int mode) { CreateDirectory(path, NULL); + return (0); } #else #include @@ -146,8 +147,7 @@ check_props(nng_msg *msg, nng_listener l, nng_dialer d) So(nng_dialer_getopt_ms(d, NNG_OPT_ZT_PING_TIME, &t) == 0); So(t > 1000 && t < 3600000); // 1 sec - 1 hour - int rv = nng_dialer_setopt_int(d, NNG_OPT_ZT_PING_COUNT, 20); - + So(nng_dialer_setopt_int(d, NNG_OPT_ZT_PING_COUNT, 20) == 0); So(nng_dialer_setopt_int(d, NNG_OPT_ZT_PING_COUNT, 20) == 0); So(nng_dialer_setopt_ms(d, NNG_OPT_ZT_PING_TIME, 2000) == 0); So(nng_listener_setopt_int(l, NNG_OPT_ZT_PING_COUNT, 0) == 0); @@ -203,7 +203,6 @@ TestMain("ZeroTier Transport", { nng_listener l; nng_socket s; char addr[NNG_MAXADDRLEN]; - int rv; So(nng_zt_register() == 0); @@ -246,7 +245,6 @@ TestMain("ZeroTier Transport", { nng_dialer d; nng_socket s; char addr[NNG_MAXADDRLEN]; - int rv; // uint64_t node = 0xb000072fa6ull; // my personal host uint64_t node = 0x2d2f619cccull; // my personal host @@ -266,7 +264,6 @@ TestMain("ZeroTier Transport", { nng_listener l; nng_socket s; char addr[NNG_MAXADDRLEN]; - int rv; uint64_t node1 = 0; uint64_t node2 = 0; @@ -315,7 +312,6 @@ TestMain("ZeroTier Transport", { nng_socket s2; char addr1[NNG_MAXADDRLEN]; char addr2[NNG_MAXADDRLEN]; - int rv; uint64_t node; port = 9944; -- cgit v1.2.3-70-g09d2