toxcore-0.2.12: A Tox protocol implementation in Haskell
Safe HaskellNone
LanguageHaskell2010

Tox.Transport.Stream

Synopsis

Documentation

data StreamState Source #

State for Congestion Control (CC) and RTT tracking.

Constructors

StreamState 

Fields

Instances

Instances details
Eq StreamState Source # 
Instance details

Defined in Tox.Transport.Stream

Show StreamState Source # 
Instance details

Defined in Tox.Transport.Stream

initState :: Timestamp -> StreamState Source #

Initial CC state.

recordPacketSent :: SeqNum -> Timestamp -> StreamState -> StreamState Source #

Record when a lossless packet was sent.

recordPacketAcked :: SeqNum -> Timestamp -> StreamState -> StreamState Source #

Record when a packet was acknowledged by the peer. Updates RTT metrics.

updateSendRate :: Int -> Timestamp -> StreamState -> StreamState Source #

Periodically update the send rate based on throughput. Should be called approximately every 1.2s.

recordCongestion :: Timestamp -> StreamState -> StreamState Source #

Record a congestion event (e.g. when peer requests many packets).