diff options
| author | Garrett D'Amore <garrett@damore.org> | 2019-03-12 23:53:50 -0700 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2019-03-13 00:11:50 -0700 |
| commit | f65f819f7fb3bbe9e24bc73342b4f335f5034fe0 (patch) | |
| tree | 7d757b3904719951c16ea66b8094ef744bc0b875 /tests/ws.c | |
| parent | fff28350a84ed60df173ba73f1035db4f7b383bd (diff) | |
| download | nng-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.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -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(); }) |
