An HTTP/1.1 server for zig
0

Configure Feed

Select the types of activity you want to include in your feed.

Try to fix Window shutdown error

https://github.com/karlseguin/http.zig/issues/207

+12 -3
+1 -1
src/posix.zig
··· 498 498 .WSANOTINITIALISED => unreachable, // not initialized WSA 499 499 .WSAECONNRESET => return error.ConnectionResetByPeer, 500 500 .WSAEFAULT => unreachable, 501 - .WSAENOTSOCK => return error.FileDescriptorNotASocket, 501 + .WSAEINTR, .WSAENOTSOCK => return error.SocketNotListening, 502 502 .WSAEINVAL => return error.SocketNotListening, 503 503 .WSAEMFILE => return error.ProcessFdQuotaExceeded, 504 504 .WSAENETDOWN => return error.NetworkSubsystemFailed,
+11 -2
src/windows.zig
··· 10 10 const HANDLE = std_windows.HANDLE; 11 11 const ULONG_PTR = std_windows.ULONG_PTR; 12 12 const PVOID = std_windows.PVOID; 13 - const Win32Error = std_windows.Win32Error; 14 13 const UnexpectedError = std.posix.UnexpectedError; 15 14 const GetLastError = std_windows.GetLastError; 16 15 17 16 pub const CloseHandle = std_windows.CloseHandle; 18 17 19 18 pub fn unexpectedWSAError(err: ws2_32.WinsockError) UnexpectedError { 20 - return std_windows.unexpectedError(@as(Win32Error, @enumFromInt(@intFromEnum(err)))); 19 + @branchHint(.cold); 20 + // Do NOT route this through std_windows.unexpectedError: it takes a 21 + // Win32Error and prints it with `{t}` (@tagName). Winsock codes live in the 22 + // 10000+ range and have no Win32Error tag, so @tagName panics with "invalid 23 + // enum value". ws2_32.WinsockError is its own exhaustive enum that does have 24 + // tags for these codes, so format it directly. 25 + if (std.options.unexpected_error_tracing) { 26 + std.debug.print("error.Unexpected: WSAGetLastError({d}): {t}\n", .{ @intFromEnum(err), err }); 27 + std.debug.dumpCurrentStackTrace(.{ .first_address = @returnAddress() }); 28 + } 29 + return error.Unexpected; 21 30 } 22 31 23 32 pub fn WSASocketW(