X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fnet%2FConnectionHandler.hpp;h=ff5e0e42204c8ab9998b83ac9630aae71e19d210;hb=061b556051c4036ecd45c5bad04171543ab3ec70;hp=942826b4329349a9b58f8bd1dad2cccf93ed17be;hpb=8dc262b12992c7cd8d4bee0fa4114ee3fb6dcd87;p=blank.git diff --git a/src/net/ConnectionHandler.hpp b/src/net/ConnectionHandler.hpp index 942826b..ff5e0e4 100644 --- a/src/net/ConnectionHandler.hpp +++ b/src/net/ConnectionHandler.hpp @@ -1,6 +1,7 @@ #ifndef BLANK_NET_CONNECTIONHANDLER_HPP_ #define BLANK_NET_CONNECTIONHANDLER_HPP_ +#include "CongestionControl.hpp" #include "Packet.hpp" #include @@ -13,18 +14,20 @@ class ConnectionHandler { public: ConnectionHandler(); - float PacketLoss() const noexcept { return packet_loss; } + const CongestionControl &NetStat() const noexcept { return cc; } + void PacketSent(std::uint16_t) noexcept; void PacketLost(std::uint16_t); void PacketReceived(std::uint16_t); + void PacketIn(const UDPpacket &) noexcept; + void PacketOut(const UDPpacket &) noexcept; + void Handle(const UDPpacket &); virtual void OnTimeout() { } private: - void UpdatePacketLoss() noexcept; - // called as soon as the remote end ack'd given packet virtual void OnPacketReceived(std::uint16_t) { } // called if the remote end probably didn't get given packet @@ -41,11 +44,11 @@ private: virtual void On(const Packet::PlayerCorrection &) { } virtual void On(const Packet::ChunkBegin &) { } virtual void On(const Packet::ChunkData &) { } + virtual void On(const Packet::BlockUpdate &) { } + virtual void On(const Packet::Message &) { } private: - unsigned int packets_lost; - unsigned int packets_received; - float packet_loss; + CongestionControl cc; };