aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoreihrul <eihrul>2004-12-09 18:41:02 +0000
committereihrul <eihrul>2004-12-09 18:41:02 +0000
commit33974e01a2e3f1bc1fdad8ae05e9aa9e9612cb0d (patch)
tree10eb9e5bb56696eb36b03a8de703ec1b598ece76
parent50556696837011bf6027ad797315f7c5ebc52c77 (diff)
downloadenet-33974e01a2e3f1bc1fdad8ae05e9aa9e9612cb0d.tar.gz
enet-33974e01a2e3f1bc1fdad8ae05e9aa9e9612cb0d.zip
bug fixes
-rw-r--r--peer.c1
-rw-r--r--protocol.c18
2 files changed, 11 insertions, 8 deletions
diff --git a/peer.c b/peer.c
index 47c878c..9513728 100644
--- a/peer.c
+++ b/peer.c
@@ -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);
diff --git a/protocol.c b/protocol.c
index 5f11488..f0e8fa7 100644
--- a/protocol.c
+++ b/protocol.c
@@ -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