Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Network: fix a concurrency problem, by re-adding a copy in Connection…
…Command
- Loading branch information
Showing
1 changed file
with
12 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
nerzhul
Author
Member
|
||
return *this; | ||
} | ||
|
||
void serve(Address address_) | ||
{ | ||
|
should that not be other.raw ?