diff --git a/common/wivrn_serialization.h b/common/wivrn_serialization.h index ca9277b9..4975834d 100644 --- a/common/wivrn_serialization.h +++ b/common/wivrn_serialization.h @@ -107,6 +107,13 @@ class serialization_packet public: serialization_packet() = default; + void clear() + { + buffer.clear(); + spans.clear(); + spans.push_back({size_t(0)}); + } + void write(const void * data, size_t size) { size_t index = buffer.size(); diff --git a/common/wivrn_sockets.h b/common/wivrn_sockets.h index 87c40009..8090f589 100644 --- a/common/wivrn_sockets.h +++ b/common/wivrn_sockets.h @@ -196,7 +196,8 @@ public: template void send(T && data) { - serialization_packet p; + thread_local serialization_packet p; + p.clear(); uint8_t index = details::Index, std::tuple>::value; p.serialize(index); p.serialize(std::forward(data));