Network: fix a concurrency problem, by re-adding a copy in ConnectionCommand
parent
a383eb0eb9
commit
5b04f5e7d2
|
@ -330,6 +330,18 @@ struct ConnectionCommand
|
||||||
bool raw = false;
|
bool raw = false;
|
||||||
|
|
||||||
ConnectionCommand() = default;
|
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_)
|
void serve(Address address_)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue