1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-07 16:48:40 +00:00

Rework packet receiving in ServerThread

Notably it tries to receive all queued packets
between server steps, not just one.
This commit is contained in:
sfan5 2019-11-14 17:38:15 +01:00 committed by rubenwardy
parent 57409ef382
commit 1c61fe5ed9
5 changed files with 86 additions and 24 deletions

View file

@ -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);