1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-22 17:18:39 +00:00

Minor refactor of IncomingSplitBuffer

This commit is contained in:
sfan5 2019-08-15 20:14:44 +02:00
parent fc2f55d931
commit 428a4c86e3
2 changed files with 60 additions and 35 deletions

View file

@ -121,16 +121,20 @@ struct IncomingSplitPacket
IncomingSplitPacket() = delete;
// Key is chunk number, value is data without headers
std::map<u16, SharedBuffer<u8>> chunks;
u32 chunk_count;
float time = 0.0f; // Seconds from adding
bool reliable = false; // If true, isn't deleted on timeout
u32 chunk_count;
bool reliable; // If true, isn't deleted on timeout
bool allReceived() const
{
return (chunks.size() == chunk_count);
}
bool insert(u32 chunk_num, SharedBuffer<u8> &chunkdata);
SharedBuffer<u8> reassemble();
private:
// Key is chunk number, value is data without headers
std::map<u16, SharedBuffer<u8>> chunks;
};
/*