aboutsummaryrefslogtreecommitdiffhomepage
path: root/protocol.c
diff options
context:
space:
mode:
authoreihrul <eihrul>2007-10-12 17:37:31 +0000
committereihrul <eihrul>2007-10-12 17:37:31 +0000
commitea03f968815f1af71b9f447836c231dd4f505d35 (patch)
tree7abcaab22bc8dc6fa48f42e7aeab887b2c91a0ce /protocol.c
parente1bafe24253a0543ef7ba64542c6b098f79f3e7f (diff)
downloadenet-ea03f968815f1af71b9f447836c231dd4f505d35.tar.gz
enet-ea03f968815f1af71b9f447836c231dd4f505d35.zip
*** empty log message ***
Diffstat (limited to 'protocol.c')
-rw-r--r--protocol.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/protocol.c b/protocol.c
index e426243..3173fe0 100644
--- a/protocol.c
+++ b/protocol.c
@@ -163,8 +163,6 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
ENetOutgoingCommand * outgoingCommand;
ENetListIterator currentCommand;
ENetProtocolCommand commandNumber;
- ENetChannel * channel;
- enet_uint16 reliableWindow;
for (currentCommand = enet_list_begin (& peer -> sentReliableCommands);
currentCommand != enet_list_end (& peer -> sentReliableCommands);
@@ -180,13 +178,16 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
if (currentCommand == enet_list_end (& peer -> sentReliableCommands))
return ENET_PROTOCOL_COMMAND_NONE;
- reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
- channel = & peer -> channels [channelID];
- if (channel -> reliableWindows [reliableWindow] > 0)
+ if (channelID < peer -> channelCount)
{
- -- channel -> reliableWindows [reliableWindow];
- if (! channel -> reliableWindows [reliableWindow])
- channel -> usedReliableWindows &= ~ (1 << reliableWindow);
+ ENetChannel * channel = & peer -> channels [channelID];
+ enet_uint16 reliableWindow = reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
+ if (channel -> reliableWindows [reliableWindow] > 0)
+ {
+ -- channel -> reliableWindows [reliableWindow];
+ if (! channel -> reliableWindows [reliableWindow])
+ channel -> usedReliableWindows &= ~ (1 << reliableWindow);
+ }
}
commandNumber = outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK;