diff options
author | Loïc Blot <loic.blot@unix-experience.fr> | 2017-09-04 16:46:03 +0200 |
---|---|---|
committer | Loïc Blot <loic.blot@unix-experience.fr> | 2017-09-04 16:46:03 +0200 |
commit | 5b04f5e7d231437b534f4cad39da78624d97c584 (patch) | |
tree | d0e53f5b318fd01f83e94df5954e79d43dc50ff9 /src/network | |
parent | a383eb0eb98ffcc835e17ee847c459edff2b53ec (diff) | |
download | minetest-5b04f5e7d231437b534f4cad39da78624d97c584.tar.gz minetest-5b04f5e7d231437b534f4cad39da78624d97c584.tar.bz2 minetest-5b04f5e7d231437b534f4cad39da78624d97c584.zip |
Network: fix a concurrency problem, by re-adding a copy in ConnectionCommand
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/connection.h | 12 |
1 files changed, 12 insertions, 0 deletions
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<u8>(*other.data, other.data.getSize()); + reliable = other.reliable; + raw = other.reliable; + return *this; + } void serve(Address address_) { |