mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-05 09:10:53 +02:00
1093a36bc3
Windows test code pre-picked a random port via GetRandomPort() (returning a value in [49152, 65535]) before calling bind(), with no check that the port was free and no retry on collision. Under load this occasionally collided with an already-bound port and aborted the test with "tcp bind failed", producing intermittent Jenkins failures (e.g. PRB windows-test-v2 #17140 in the OCSP responder test). The Unix path already does the right thing: bind to port 0 (OS-assigned ephemeral) and read the port back via getsockname(). The same primitives exist in Winsock 1.1, so drop the USE_WINDOWS_API guard around the getsockname block in tcp_listen()/udp_accept() and remove the per-caller GetRandomPort() workarounds in the OCSP responder, server example, and the api.c / test_ossl_bio.c test sites. socklen_t is already typedef'd as int on Windows in test.h. GetRandomPort() itself is left in place since it is a static inline in a shipped public test header.