From 2a85cd64459f6ba038d233a634d9440490dbba12 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Sun, 23 Jul 2023 21:05:47 -0400 Subject: better partial message handling --- protocol.c | 3 +++ unix.c | 2 +- win32.c | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/protocol.c b/protocol.c index b7af48d..73e8056 100644 --- a/protocol.c +++ b/protocol.c @@ -1243,6 +1243,9 @@ enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event) & buffer, 1); + if (receivedLength == -2) + continue; + if (receivedLength < 0) return -1; diff --git a/unix.c b/unix.c index 2c7d847..6669216 100644 --- a/unix.c +++ b/unix.c @@ -509,7 +509,7 @@ enet_socket_receive (ENetSocket socket, #ifdef HAS_MSGHDR_FLAGS if (msgHdr.msg_flags & MSG_TRUNC) - return -1; + return -2; #endif if (address != NULL) diff --git a/win32.c b/win32.c index 0953466..f67e16b 100644 --- a/win32.c +++ b/win32.c @@ -382,13 +382,15 @@ enet_socket_receive (ENetSocket socket, case WSAEWOULDBLOCK: case WSAECONNRESET: return 0; + case WSAEMSGSIZE: + return -2; } return -1; } if (flags & MSG_PARTIAL) - return -1; + return -2; if (address != NULL) { -- cgit v1.2.3