Skip to content

Commit

Permalink
check for EINTR
Browse files Browse the repository at this point in the history
  • Loading branch information
lsalzman committed May 20, 2024
1 parent 4ce1625 commit 80103c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
12 changes: 8 additions & 4 deletions unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,14 @@ enet_socket_receive (ENetSocket socket,

if (recvLength == -1)
{
if (errno == EWOULDBLOCK)
return 0;

return -1;
switch (errno)
{
case EWOULDBLOCK:
case EINTR:
return 0;
default:
return -1;
}
}

#ifdef HAS_MSGHDR_FLAGS
Expand Down
1 change: 1 addition & 0 deletions win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ enet_socket_receive (ENetSocket socket,
{
case WSAEWOULDBLOCK:
case WSAECONNRESET:
case WSAEINTR:
return 0;
case WSAEMSGSIZE:
return -2;
Expand Down

0 comments on commit 80103c8

Please sign in to comment.