diff options
Diffstat (limited to 'peer.c')
-rw-r--r-- | peer.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -473,6 +473,19 @@ enet_peer_queue_acknowledgement (ENetPeer * peer, const ENetProtocol * command, { ENetAcknowledgement * acknowledgement; + if (command -> header.channelID < peer -> channelCount) + { + ENetChannel * channel = & peer -> channels [command -> header.channelID]; + enet_uint16 reliableWindow = command -> header.reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE, + currentWindow = channel -> incomingReliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; + + if (reliableWindow < currentWindow) + reliableWindow += ENET_PEER_RELIABLE_WINDOWS; + + if (reliableWindow < currentWindow || reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS) + return NULL; + } + peer -> outgoingDataTotal += sizeof (ENetProtocolAcknowledge); acknowledgement = (ENetAcknowledgement *) enet_malloc (sizeof (ENetAcknowledgement)); |