projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a383eb0
)
Network: fix a concurrency problem, by re-adding a copy in ConnectionCommand
author
Loïc Blot
<loic.blot@unix-experience.fr>
Mon, 4 Sep 2017 14:46:03 +0000
(16:46 +0200)
committer
Loïc Blot
<loic.blot@unix-experience.fr>
Mon, 4 Sep 2017 14:46:03 +0000
(16:46 +0200)
src/network/connection.h
patch
|
blob
|
history
diff --git
a/src/network/connection.h
b/src/network/connection.h
index e1bb613f084d4c5c07cca5546f1fcc9911830db8..94d5aa1e9ffa181d2ae9a3db7d1779c7c3ceb7f5 100644
(file)
--- 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_)
{