Tokens left and when they were last counted, in seconds.
Modulevortex-ws-0.2.1GHC2024
Vortex.Ws.Door.Rate
Token buckets, one per peer and one for the whole door, and the count of open sessions. The arithmetic is pure (take1, opens); the gate keeps the rest in STM.
- 3 types
- 8 values
- Packagevortex-ws-0.2.1
- Exports11
- LanguageGHC2024
- LicenceBSD-3-Clause
- SourceRate.hs
Refill for the time elapsed, then take a token if there is one.
Count a session in, unless the door or its peer is at the limit.
Count a session out; a peer with none left is forgotten.
Charge one frame to its peer and to the door. A peer's bucket that has refilled is forgotten, so the map holds only peers that are busy.
Count a session in, unless the door or its peer is at the limit.