diff options
author | B3n30 <benediktthomas@gmail.com> | 2017-07-15 21:24:11 +0200 |
---|---|---|
committer | B3n30 <benediktthomas@gmail.com> | 2017-07-16 21:30:17 +0200 |
commit | 77df82f5d66683f4928c4ad37f1deb77b79bb7df (patch) | |
tree | 036bb0c3ae09eccfa1e4de78c38083daf4835c85 /src/network/packet.h | |
parent | 253d3dd3d889eb61131810b04137ee3f9445db64 (diff) |
Network: Changed timeout for receiving packets to 100ms
Diffstat (limited to 'src/network/packet.h')
-rw-r--r-- | src/network/packet.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/network/packet.h b/src/network/packet.h index 026271701..94b351ab1 100644 --- a/src/network/packet.h +++ b/src/network/packet.h @@ -115,6 +115,12 @@ private: template <typename T> Packet& Packet::operator>>(std::vector<T>& out_data) { + // First extract the size + u32 size = 0; + *this >> size; + out_data.resize(size); + + // Then extract the data for (std::size_t i = 0; i < out_data.size(); ++i) { T character = 0; *this >> character; @@ -135,6 +141,10 @@ Packet& Packet::operator>>(std::array<T, S>& out_data) { template <typename T> Packet& Packet::operator<<(const std::vector<T>& in_data) { + // First insert the size + *this << static_cast<u32>(in_data.size()); + + // Then insert the data for (std::size_t i = 0; i < in_data.size(); ++i) { *this << in_data[i]; } |