aboutsummaryrefslogtreecommitdiff
path: root/src/network/networkpacket.cpp
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2019-11-14 17:38:15 +0100
committerrubenwardy <rw@rubenwardy.com>2019-12-31 21:31:53 +0000
commit1c61fe5ed930720485ef42571739e5efc39a14c9 (patch)
tree66e72a976a8aa7c5a88343181e69a3bfa21ebcc9 /src/network/networkpacket.cpp
parent57409ef382509a4a293683b78b44816ee29bb8d4 (diff)
downloadminetest-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.cpp9
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);