aboutsummaryrefslogtreecommitdiff
path: root/tests/ws.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2019-03-12 23:53:50 -0700
committerGarrett D'Amore <garrett@damore.org>2019-03-13 00:11:50 -0700
commitf65f819f7fb3bbe9e24bc73342b4f335f5034fe0 (patch)
tree7d757b3904719951c16ea66b8094ef744bc0b875 /tests/ws.c
parentfff28350a84ed60df173ba73f1035db4f7b383bd (diff)
downloadnng-f65f819f7fb3bbe9e24bc73342b4f335f5034fe0.tar.gz
nng-f65f819f7fb3bbe9e24bc73342b4f335f5034fe0.tar.bz2
nng-f65f819f7fb3bbe9e24bc73342b4f335f5034fe0.zip
fixes #907 WebSocket ephemeral port cannot be reused
Diffstat (limited to 'tests/ws.c')
-rw-r--r--tests/ws.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ws.c b/tests/ws.c
index e5cc8ba5..59d4d52d 100644
--- a/tests/ws.c
+++ b/tests/ws.c
@@ -155,5 +155,25 @@ TestMain("WebSocket Transport", {
So(nng_dial(s2, "ws://127.0.0.1:5599/one", NULL, 0) == 0);
});
+ Convey("Wild card port works and can be used again", {
+ nng_socket s1;
+ nng_socket s2;
+ nng_listener l1;
+ int port;
+ char ws_url[128];
+ So(nng_pair_open(&s1) == 0);
+ So(nng_pair_open(&s2) == 0);
+ Reset({
+ nng_close(s1);
+ nng_close(s2);
+ });
+ So(nng_listen(s1, "ws://*:0/one", &l1, 0) == 0);
+ So(nng_listener_getopt_int(
+ l1, NNG_OPT_TCP_BOUND_PORT, &port) == 0);
+ So(port != 0);
+ snprintf(ws_url, 1023, "ws://*:%d/two", port);
+ So(nng_listen(s2, ws_url, NULL, 0) == 0);
+ });
+
nng_fini();
})