diff options
author | Lee Salzman <[email protected]> | 2024-07-24 01:52:32 -0400 |
---|---|---|
committer | Lee Salzman <[email protected]> | 2024-07-24 01:52:32 -0400 |
commit | 1e80a78f481cb2d2e4d9a0e2718b91995f2de51c (patch) | |
tree | 6331010eb597498998cfd4e552c3d59b5b3e93dd /peer.c | |
parent | a52811ef275e25d4df29dbee68fee410249d571e (diff) | |
download | enet-1e80a78f481cb2d2e4d9a0e2718b91995f2de51c.tar.gz enet-1e80a78f481cb2d2e4d9a0e2718b91995f2de51c.zip |
bound totalWaitingData decrement
Diffstat (limited to 'peer.c')
-rw-r--r-- | peer.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -4,6 +4,7 @@ */ #include <string.h> #define ENET_BUILDING_LIB 1 +#include "enet/utility.h" #include "enet/enet.h" /** @defgroup peer ENet peer functions @@ -249,7 +250,7 @@ enet_peer_receive (ENetPeer * peer, enet_uint8 * channelID) enet_free (incomingCommand); - peer -> totalWaitingData -= packet -> dataLength; + peer -> totalWaitingData -= ENET_MIN (peer -> totalWaitingData, packet -> dataLength); return packet; } @@ -295,7 +296,7 @@ enet_peer_remove_incoming_commands (ENetPeer * peer, ENetList * queue, ENetListI { -- incomingCommand -> packet -> referenceCount; - peer -> totalWaitingData -= incomingCommand -> packet -> dataLength; + peer -> totalWaitingData -= ENET_MIN (peer -> totalWaitingData, incomingCommand -> packet -> dataLength); if (incomingCommand -> packet -> referenceCount == 0) enet_packet_destroy (incomingCommand -> packet); |