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/networkpacket.cpp | |
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/networkpacket.cpp')
-rw-r--r-- | src/network/networkpacket.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/network/networkpacket.cpp b/src/network/networkpacket.cpp index 22c035c5b..4d531b611 100644 --- a/src/network/networkpacket.cpp +++ b/src/network/networkpacket.cpp @@ -66,6 +66,15 @@ void NetworkPacket::putRawPacket(u8 *data, u32 datasize, session_t peer_id) memcpy(m_data.data(), &data[2], m_datasize); } +void NetworkPacket::clear() +{ + m_data.clear(); + m_datasize = 0; + m_read_offset = 0; + m_command = 0; + m_peer_id = 0; +} + const char* NetworkPacket::getString(u32 from_offset) { checkReadOffset(from_offset, 0); |