diff options
author | sfan5 <sfan5@live.de> | 2019-11-14 17:38:15 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2019-12-31 21:31:53 +0000 |
commit | 1c61fe5ed930720485ef42571739e5efc39a14c9 (patch) | |
tree | 66e72a976a8aa7c5a88343181e69a3bfa21ebcc9 /src/network/connection.h | |
parent | 57409ef382509a4a293683b78b44816ee29bb8d4 (diff) | |
download | minetest-1c61fe5ed930720485ef42571739e5efc39a14c9.tar.gz minetest-1c61fe5ed930720485ef42571739e5efc39a14c9.tar.bz2 minetest-1c61fe5ed930720485ef42571739e5efc39a14c9.zip |
Rework packet receiving in ServerThread
Notably it tries to receive all queued packets
between server steps, not just one.
Diffstat (limited to 'src/network/connection.h')
-rw-r--r-- | src/network/connection.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/network/connection.h b/src/network/connection.h index 057bd39f6..d7f1e0fe8 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -771,6 +771,7 @@ public: bool Connected(); void Disconnect(); void Receive(NetworkPacket* pkt); + bool TryReceive(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); @@ -803,6 +804,8 @@ protected: UDPSocket m_udpSocket; MutexedQueue<ConnectionCommand> m_command_queue; + bool Receive(NetworkPacket *pkt, u32 timeout); + void putEvent(ConnectionEvent &e); void TriggerSend(); |