X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fnet%2FCongestionControl.hpp;h=76f98f61d08173189952b33274398068bfb0af35;hb=ee920127d653b8a3cfbee1efefde909ffa177662;hp=ea71c55abe7c8625a42c31edf48f0fe8e01b2e45;hpb=1a237f316ee603e2130dc46b9f7d75a169763543;p=blank.git diff --git a/src/net/CongestionControl.hpp b/src/net/CongestionControl.hpp index ea71c55..76f98f6 100644 --- a/src/net/CongestionControl.hpp +++ b/src/net/CongestionControl.hpp @@ -21,6 +21,10 @@ public: /// get recommended mode of operation Mode GetMode() const noexcept { return mode; } + /// according to current mode, drop this many unimportant packets + unsigned int SuggestedPacketSkip() const noexcept { return (1 << mode) - 1; } + /// according to current mode, pause between large uncritical packets for this many ticks + unsigned int SuggestedPacketHold() const noexcept { return (1 << (mode + 1)) - 1; } /// packet loss as factor float PacketLoss() const noexcept { return packet_loss; } @@ -43,6 +47,7 @@ private: void UpdateRTT(std::uint16_t) noexcept; bool SamplePacket(std::uint16_t) const noexcept; + std::size_t SampleIndex(std::uint16_t) const noexcept; void UpdateStats() noexcept; @@ -62,7 +67,6 @@ private: float packet_loss; Uint32 stamps[16]; - std::size_t stamp_cursor; std::uint16_t stamp_last; float rtt;