diff options
author | Determinant <[email protected]> | 2020-02-20 11:56:48 -0500 |
---|---|---|
committer | Determinant <[email protected]> | 2020-02-20 11:56:48 -0500 |
commit | bb1c884a2f466cccbc4e719f8ec021e627f2dda3 (patch) | |
tree | 720e892b9cd099f267c7c83826fd1e8d13c3c0c7 /test/test_p2p_stress.cpp | |
parent | 49d48637032dcf42c5fcf8a4062a7daca2c32231 (diff) |
fix the potential data race in known_peers
Diffstat (limited to 'test/test_p2p_stress.cpp')
-rw-r--r-- | test/test_p2p_stress.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/test_p2p_stress.cpp b/test/test_p2p_stress.cpp index dca9cf4..f5a0b5d 100644 --- a/test/test_p2p_stress.cpp +++ b/test/test_p2p_stress.cpp @@ -238,7 +238,13 @@ int main(int argc, char **argv) { masksigs(); a.net->listen(a.addr); for (auto &paddr: addrs) - if (paddr != a.addr) a.net->add_peer(paddr); + if (paddr != a.addr) + { + salticidae::PeerId pid{paddr}; + a.net->add_peer(pid); + a.net->set_peer_addr(pid, paddr); + a.net->conn_peer(pid); + } a.ec.dispatch();})); EventContext ec; |