From c25b57b2c173308c1d6dd37f70d3058e143caf47 Mon Sep 17 00:00:00 2001 From: Lee Salzman Date: Thu, 16 Apr 2020 00:15:18 -0400 Subject: stabilize packet throttle when RTT variance is low --- peer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'peer.c') diff --git a/peer.c b/peer.c index 2f483a2..1278b85 100644 --- a/peer.c +++ b/peer.c @@ -66,7 +66,7 @@ enet_peer_throttle (ENetPeer * peer, enet_uint32 rtt) peer -> packetThrottle = peer -> packetThrottleLimit; } else - if (rtt < peer -> lastRoundTripTime) + if (rtt <= peer -> lastRoundTripTime) { peer -> packetThrottle += peer -> packetThrottleAcceleration; @@ -76,7 +76,7 @@ enet_peer_throttle (ENetPeer * peer, enet_uint32 rtt) return 1; } else - if (rtt > peer -> lastRoundTripTime + 2 * peer -> lastRoundTripTimeVariance) + if (rtt >= peer -> lastRoundTripTime + 2 * peer -> lastRoundTripTimeVariance) { if (peer -> packetThrottle > peer -> packetThrottleDeceleration) peer -> packetThrottle -= peer -> packetThrottleDeceleration; -- cgit v1.2.3