aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoreihrul <eihrul>2011-01-31 06:17:58 +0000
committereihrul <eihrul>2011-01-31 06:17:58 +0000
commit5258b406407d80ea44424d390bb9dfc399d4a35c (patch)
tree7715c18be635ed1f224e68e912001cd5d3098e88
parent907b4ba2f5718c16ccf8e948be2090a7be485b12 (diff)
downloadenet-5258b406407d80ea44424d390bb9dfc399d4a35c.tar.gz
enet-5258b406407d80ea44424d390bb9dfc399d4a35c.zip
fixed bug where low reliable window stops pings from getting through
-rw-r--r--ChangeLog2
-rw-r--r--protocol.c17
2 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e604a33..553c03d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
-ENet CVS (December 23, 2010):
+ENet CVS (January 31, 2011):
* reliable data window size now scales with the throttle
* fixed bug in fragment length calculation when checksums are used
diff --git a/protocol.c b/protocol.c
index f9b2b09..3c4347d 100644
--- a/protocol.c
+++ b/protocol.c
@@ -1262,6 +1262,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
ENetChannel *channel;
enet_uint16 reliableWindow;
size_t commandSize;
+ int windowExceeded = 0;
currentCommand = enet_list_begin (& peer -> outgoingReliableCommands);
@@ -1278,7 +1279,14 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) |
(((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow)))))
break;
-
+
+ if (windowExceeded && outgoingCommand -> packet != NULL)
+ {
+ currentCommand = enet_list_next (currentCommand);
+
+ continue;
+ }
+
commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK];
if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
@@ -1294,7 +1302,12 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
enet_uint32 windowSize = (peer -> packetThrottle * peer -> windowSize) / ENET_PEER_PACKET_THROTTLE_SCALE;
if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > ENET_MAX (windowSize, peer -> mtu))
- break;
+ {
+ windowExceeded = 1;
+ currentCommand = enet_list_next (currentCommand);
+
+ continue;
+ }
if ((enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength))
{