diff options
author | [email protected] <[email protected]> | 2015-03-09 11:54:01 -0700 |
---|---|---|
committer | [email protected] <[email protected]> | 2015-03-09 11:54:01 -0700 |
commit | 9b06a12e716b79ed09557d2d4ae6173b2ea6c3a3 (patch) | |
tree | 0937c0cc4a4994ffb786b67e2180c6b9571b2edd /protocol.c | |
parent | 8df6e58c5f6852b641634df4f3009a8a4e56acfd (diff) | |
download | enet-9b06a12e716b79ed09557d2d4ae6173b2ea6c3a3.tar.gz enet-9b06a12e716b79ed09557d2d4ae6173b2ea6c3a3.zip |
handle case in bandwidth limit protocol where either incoming or outgoing limits are disabled, but not both
Diffstat (limited to 'protocol.c')
-rw-r--r-- | protocol.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -765,6 +765,10 @@ enet_protocol_handle_bandwidth_limit (ENetHost * host, ENetPeer * peer, const EN if (peer -> incomingBandwidth == 0 && host -> outgoingBandwidth == 0) peer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; else + if (peer -> incomingBandwidth == 0 || host -> outgoingBandwidth == 0) + peer -> windowSize = (ENET_MAX (peer -> incomingBandwidth, host -> outgoingBandwidth) / + ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; + else peer -> windowSize = (ENET_MIN (peer -> incomingBandwidth, host -> outgoingBandwidth) / ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; |