mirror of
https://github.com/lsalzman/enet
synced 2024-11-21 14:29:05 -07:00
bug fixes
This commit is contained in:
parent
5055669683
commit
33974e01a2
2 changed files with 11 additions and 8 deletions
1
peer.c
1
peer.c
|
@ -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);
|
||||||
|
|
18
protocol.c
18
protocol.c
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue