net: Always set WSA_FLAG_OVERLAPPED when creating Windows sockets. Rework send and receive logic to use overlapped I/O.

build-web: Remove the now-redundant supports_recv logic
This commit is contained in:
kcbanner
2025-08-09 18:48:15 -04:00
parent 125c4a265a
commit 95f57c3369
6 changed files with 74 additions and 43 deletions

View File

@@ -287,20 +287,14 @@ fn serveWebSocket(ws: *WebServer, sock: *http.Server.WebSocket) !noreturn {
copy.* = @atomicLoad(u8, shared, .monotonic);
}
// Calling WSARecvFrom on one thread while another calls WSASend deadlocks.
// This functionality is disabled until std.net uses overlapped sockets on Windows.
const supports_recv = builtin.os.tag != .windows;
const recv_thread = if (supports_recv)
try std.Thread.spawn(.{}, recvWebSocketMessages, .{ ws, sock })
else {};
defer if (supports_recv) recv_thread.join();
const recv_thread = try std.Thread.spawn(.{}, recvWebSocketMessages, .{ ws, sock });
defer recv_thread.join();
{
const hello_header: abi.Hello = .{
.status = prev_build_status,
.flags = .{
.time_report = ws.graph.time_report,
.supports_recv = supports_recv,
},
.timestamp = ws.now(),
.steps_len = @intCast(ws.all_steps.len),