aboutsummaryrefslogtreecommitdiffhomepage
path: root/peer.c
diff options
context:
space:
mode:
Diffstat (limited to 'peer.c')
-rw-r--r--peer.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/peer.c b/peer.c
index 3bd3ba6..25f2a27 100644
--- a/peer.c
+++ b/peer.c
@@ -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));