1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

connection: Remove unused timeout feature

Was only used for a unit test and incorrectly at that.
This commit is contained in:
red-001 2024-08-31 16:44:12 +01:00 committed by sfan5
parent 6608057971
commit 1b8b84bee8
7 changed files with 24 additions and 50 deletions

View file

@ -48,7 +48,6 @@ class IConnection
public:
virtual ~IConnection() = default;
virtual void SetTimeoutMs(u32 timeout) = 0;
virtual void Serve(Address bind_addr) = 0;
virtual void Connect(Address address) = 0;
virtual bool Connected() = 0;
@ -56,7 +55,6 @@ public:
virtual void DisconnectPeer(session_t peer_id) = 0;
virtual bool ReceiveTimeoutMs(NetworkPacket *pkt, u32 timeout_ms) = 0;
virtual void Receive(NetworkPacket *pkt) = 0;
bool TryReceive(NetworkPacket *pkt) {
return ReceiveTimeoutMs(pkt, 0);
}

View file

@ -1486,13 +1486,6 @@ bool Connection::ReceiveTimeoutMs(NetworkPacket *pkt, u32 timeout_ms)
return false;
}
void Connection::Receive(NetworkPacket *pkt)
{
bool any = ReceiveTimeoutMs(pkt, m_bc_receive_timeout);
if (!any)
throw NoIncomingDataException("No incoming data");
}
void Connection::Send(session_t peer_id, u8 channelnum,
NetworkPacket *pkt, bool reliable)
{

View file

@ -249,13 +249,11 @@ public:
void putCommand(ConnectionCommandPtr c);
void SetTimeoutMs(u32 timeout) { m_bc_receive_timeout = timeout; }
void Serve(Address bind_addr);
void Connect(Address address);
bool Connected();
void Disconnect();
bool ReceiveTimeoutMs(NetworkPacket *pkt, u32 timeout_ms);
void Receive(NetworkPacket *pkt);
void Send(session_t peer_id, u8 channelnum, NetworkPacket *pkt, bool reliable);
session_t GetPeerID() const { return m_peer_id; }
Address GetPeerAddress(session_t peer_id);
@ -317,7 +315,6 @@ private:
// Backwards compatibility
PeerHandler *m_bc_peerhandler;
u32 m_bc_receive_timeout = 0;
bool m_shutting_down = false;
};

View file

@ -51,12 +51,6 @@ public:
InvalidIncomingDataException(const char *s) : BaseException(s) {}
};
class NoIncomingDataException : public BaseException
{
public:
NoIncomingDataException(const char *s) : BaseException(s) {}
};
}
class SocketException : public BaseException