Skip to content

Commit

Permalink
Add WSAENOTCONN to fix Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaivel committed May 29, 2024
1 parent fedea42 commit 1e8f3d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/network/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,9 @@ long net_recv_udp_timeout(struct net_context *ctx, void *__restrict __buf, size_
static bool was_operation_invalid(ssize_t n)
{
#ifdef _WIN32
return (n == SOCKET_ERROR && WSAGetLastError() != WSAEWOULDBLOCK);
// WSAENOTCONN should be a temp fix, bc without it we're likely not connected yet
int error = WSAGetLastError();
return (n == SOCKET_ERROR && error != WSAEWOULDBLOCK && error != WSAEINPROGRESS && error != WSAENOTCONN);
#else
return (n == -1 && errno != EAGAIN && errno != EWOULDBLOCK);
#endif
Expand Down

0 comments on commit 1e8f3d2

Please sign in to comment.