bug fixes

This commit is contained in:
eihrul 2004-12-09 18:41:02 +00:00
parent 5055669683
commit 33974e01a2
2 changed files with 11 additions and 8 deletions

1
peer.c
View file

@ -558,6 +558,7 @@ enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command,
switch (command -> header.command) switch (command -> header.command)
{ {
case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT:
case ENET_PROTOCOL_COMMAND_SEND_RELIABLE: case ENET_PROTOCOL_COMMAND_SEND_RELIABLE:
for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands)); for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands));
currentCommand != enet_list_end (& channel -> incomingReliableCommands); currentCommand != enet_list_end (& channel -> incomingReliableCommands);

View file

@ -396,17 +396,19 @@ enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENet
fragmentCount != startCommand -> fragmentCount) fragmentCount != startCommand -> fragmentCount)
return; return;
if ((startCommand -> fragments [fragmentNumber / 32] & (1 << fragmentNumber)) == 0) if ((startCommand -> fragments [fragmentNumber / 32] & (1 << (fragmentNumber & 32))) == 0)
-- startCommand -> fragmentsRemaining; {
-- startCommand -> fragmentsRemaining;
startCommand -> fragments [fragmentNumber / 32] |= (1 << fragmentNumber); startCommand -> fragments [fragmentNumber / 32] |= (1 << (fragmentNumber & 32));
if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength) if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength)
fragmentLength = startCommand -> packet -> dataLength - fragmentOffset; fragmentLength = startCommand -> packet -> dataLength - fragmentOffset;
memcpy (startCommand -> packet -> data + fragmentOffset, memcpy (startCommand -> packet -> data + fragmentOffset,
(enet_uint8 *) command + sizeof (ENetProtocolSendFragment), (enet_uint8 *) command + sizeof (ENetProtocolSendFragment),
fragmentLength); fragmentLength);
}
} }
static void static void