diff options
-rw-r--r-- | peer.c | 1 | ||||
-rw-r--r-- | protocol.c | 18 |
2 files changed, 11 insertions, 8 deletions
@@ -558,6 +558,7 @@ enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command, switch (command -> header.command) { + case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT: case ENET_PROTOCOL_COMMAND_SEND_RELIABLE: for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands)); currentCommand != enet_list_end (& channel -> incomingReliableCommands); @@ -396,17 +396,19 @@ enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENet fragmentCount != startCommand -> fragmentCount) return; - if ((startCommand -> fragments [fragmentNumber / 32] & (1 << fragmentNumber)) == 0) - -- startCommand -> fragmentsRemaining; + if ((startCommand -> fragments [fragmentNumber / 32] & (1 << (fragmentNumber & 32))) == 0) + { + -- startCommand -> fragmentsRemaining; - startCommand -> fragments [fragmentNumber / 32] |= (1 << fragmentNumber); + startCommand -> fragments [fragmentNumber / 32] |= (1 << (fragmentNumber & 32)); - if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength) - fragmentLength = startCommand -> packet -> dataLength - fragmentOffset; + if (fragmentOffset + fragmentLength > startCommand -> packet -> dataLength) + fragmentLength = startCommand -> packet -> dataLength - fragmentOffset; - memcpy (startCommand -> packet -> data + fragmentOffset, - (enet_uint8 *) command + sizeof (ENetProtocolSendFragment), - fragmentLength); + memcpy (startCommand -> packet -> data + fragmentOffset, + (enet_uint8 *) command + sizeof (ENetProtocolSendFragment), + fragmentLength); + } } static void |