Open pfgithub opened 17 hours ago
This works fine on Mac and Linux, so I assume it's a windows issue, or an issue with Zig's window wrapper. Unfortunately, I can't test.
Can you try replacing the call to:
try app.client.close(.{});
with:
try std.posix.shutdown(app.client.stream.handle, .both);
std.posix.close(app.client.stream.handle);
It hangs on std.posix.shutdown
. I guess there's some kind of other problem because it also hangs on writeBin
and setting writeTimeout
has no effect.
It works fine as long as the recvThread isn't spawned (app.client.close() and std.posix.shutdown both work then), so maybe some problem with writing while there is an active read call on windows? readTimeout
doesn't seem to work either so I can't see what would happen if trying to write while there isn't a read active.
Possibly a problem with zig's windows implementations of the posix fns
This code would implement a program that lets you enter a message to send to the websocket server and sends it on enter. When you exit the program by pressing enter on windows, it just hangs and never closes the websocket connection. How do you close the connection and stop an active blocking
read()
call on another thread?