1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Time out when reliables can't be delivered

If one of the channels stalls for whatever reason we can't pretend the connection is fine.
This commit is contained in:
sfan5 2024-01-05 12:24:14 +01:00
parent 9f684eac92
commit 3987318f09
3 changed files with 55 additions and 16 deletions

View file

@ -262,7 +262,9 @@ public:
void insert(BufferedPacketPtr &p_ptr, u16 next_expected);
void incrementTimeouts(float dtime);
std::vector<ConstSharedPtr<BufferedPacket>> getTimedOuts(float timeout, u32 max_packets);
u32 getTimedOuts(float timeout);
// timeout relative to last resend
std::vector<ConstSharedPtr<BufferedPacket>> getResend(float timeout, u32 max_packets);
void print();
bool empty();
@ -525,7 +527,7 @@ class Peer {
bool isHalfOpen() const { return m_half_open; }
void SetFullyOpen() { m_half_open = false; }
bool isTimedOut(float timeout);
virtual bool isTimedOut(float timeout, std::string &reason);
unsigned int m_increment_packets_remaining = 0;
@ -636,6 +638,8 @@ public:
SharedBuffer<u8> addSplitPacket(u8 channel, BufferedPacketPtr &toadd,
bool reliable);
bool isTimedOut(float timeout, std::string &reason) override;
protected:
/*
Calculates avg_rtt and resend_timeout.