RateLimiter
Session-wide upload/download rate limiting: the live driver for the pure BandwidthManager/BandwidthChannel port.
libtorrent gives session_impl one bandwidth_manager per direction plus a global bandwidth_channel pair, with per-torrent channels layered on top; a peer_connection asks for quota before moving payload and is parked in the manager's queue when the buckets are empty. This class is that wiring on coroutines: acquireUpload/acquireDownload suspend until the requested bytes are granted, and a periodic update (driven by start's ticker, or by a test directly) refills the buckets and releases parked waiters. This is the on_tick → update_quotas cadence.
A channel whose limit is 0 is unlimited and never participates (libtorrent skips zero-throttle channels when assembling a request's channel list), so with no limits configured every acquire returns immediately.
Download limiting works by delaying the receive path after the bytes arrived (back-pressure: a reader that stops draining stalls the sender's TCP window), which is also how libtorrent's receive quota throttles a peer.
Properties
Functions
Suspend until bytes of download quota are granted.
Suspend until bytes of upload quota are granted.
A per-torrent channel pair to layer under the global limit (peer_class lite).
Cap session download at bytesPerSecond (0 = unlimited). download_rate_limit.
Cap session upload at bytesPerSecond (0 = unlimited). upload_rate_limit.
One scheduling round: refill the buckets with dtMilliseconds worth of quota and dispatch satisfied waiters. Exposed for deterministic tests.