mirror of
https://github.com/i2p/i2p.i2p.git
synced 2026-09-02 00:29:09 +00:00
The request throttler had several problems: - Throttling was very laggy, but when it reacted it throttled too quickly. - PartialPieces got returned back to PeerCoordinator, and then back to PeerState, every few seconds, rather than continuing steady-state in PeerState - Holding the PartialPiece in the PeerCoordinator for several seconds while staying interested is poor and risks snubbing - Max request queue size was reduced far too quickly, doing so exponentially when the reduction occurred linearly - shouldRequest() called the request limiter second in the conditional, so the estimator was not decayed properly when over down bw limit - shouldRequest() used overDownBandwidthLimit() rather than _down.offer(), ensuring a very slow and laggy feedback loop. - Requests were added too quickly on unthrottle Fix these by: - Fixing and slowing max request queue size reduction to simulate an exponential reduction over time when throttled - Fixing shouldRequest() to always call offer() for both limiters - Slow addition of requests after unthrottle to simulate a linear increase over time Log tweaks also The request queue now mostly maintains a steady size, and properly meters the requests. The PartialPiece returns to the PeerCoordinator much less often, and comes back to PeerState much quicker if it does. Further tuning TODO