Stat
Aggregates the six byte-stream channels of a peer connection (or the whole session). The pure-Kotlin port of libtorrent's stat (stat.hpp).
The six StatChannels, indexed by the Channel enum, split traffic by direction (upload / download) and class (BitTorrent payload, BitTorrent protocol overhead, and IP/TCP overhead). Helpers roll these up into the familiar upload_rate / total_download / ... figures the rest of libtorrent reports.
second_tick must be driven once per second (passing the real elapsed milliseconds) so each channel's smoothed rate stays in bytes/second.
Types
Functions
Direct access to a channel, mirroring stat::operator[].
Folds every channel of s into this one. (operator+=)
Record received bytes, split into payload and protocol. (received_bytes)
Account for a received SYN-ACK plus the ACK we send back. (received_synack)
Advances every channel's smoothed rate; call once per second. (second_tick)
Charges the IP/TCP overhead of moving bytesTransferred bytes to both the upload and download IP-protocol channels, matching trancieve_ip_packet.