Commit d0beb4badb

LemonBoy <thatlemon@gmail.com>
2020-11-22 10:17:51
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.
1 parent 676d7fc
Changed files (1)
lib
std
lib/std/net/test.zig
@@ -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();