Let the kernel pick a random port

Avoid errors if the socket enters the TIME_WAIT state and we need to
re-execute this test before the OS releases it.

This problem was not really a problem before since the accept()-ed
socket was never closed on the server-side.
This commit is contained in:
LemonBoy
2020-11-22 10:17:51 +01:00
parent 676d7fc63c
commit d0beb4badb

View File

@@ -145,7 +145,7 @@ test "listen on a port, send bytes, receive bytes" {
// Try only the IPv4 variant as some CI builders have no IPv6 localhost
// configured.
const localhost = try net.Address.parseIp("127.0.0.1", 8080);
const localhost = try net.Address.parseIp("127.0.0.1", 0);
var server = net.StreamServer.init(.{});
defer server.deinit();