From: Loïc Blot Date: Mon, 4 Sep 2017 14:46:03 +0000 (+0200) Subject: Network: fix a concurrency problem, by re-adding a copy in ConnectionCommand X-Git-Tag: 5.0.0~858 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5b04f5e7d231437b534f4cad39da78624d97c584;p=oweals%2Fminetest.git Network: fix a concurrency problem, by re-adding a copy in ConnectionCommand --- diff --git a/src/network/connection.h b/src/network/connection.h index e1bb613f0..94d5aa1e9 100644 --- a/src/network/connection.h +++ b/src/network/connection.h @@ -330,6 +330,18 @@ struct ConnectionCommand bool raw = false; ConnectionCommand() = default; + ConnectionCommand &operator=(const ConnectionCommand &other) + { + type = other.type; + address = other.address; + peer_id = other.peer_id; + channelnum = other.channelnum; + // We must copy the buffer here to prevent race condition + data = SharedBuffer(*other.data, other.data.getSize()); + reliable = other.reliable; + raw = other.reliable; + return *this; + } void serve(Address address_) {