diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-11-29 12:38:12 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2016-11-29 12:39:33 +0100 |
commit | 5488514b901d807a98544618cb441a28e0b28bda (patch) | |
tree | e1db2df3b6573d61e02b516c6fa2157cb6ccdb0f /src/net.cpp | |
parent | 0a0441358c81a28495914b880526bdae9262fc5a (diff) | |
parent | dfed983f19e7b61da243362f00fa3a14c92dae45 (diff) |
Merge #9225: Fix some benign races
dfed983 Fix unlocked access to vNodes.size() (Matt Corallo)
3033522 Remove double brackets in addrman (Matt Corallo)
dbfaade Fix AddrMan locking (Matt Corallo)
047ea10 Make fImporting an std::atomic (Matt Corallo)
42071ca Make fDisconnect an std::atomic (Matt Corallo)
Diffstat (limited to 'src/net.cpp')
-rw-r--r-- | src/net.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/net.cpp b/src/net.cpp index ce87150ae3..ba74cd071e 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1103,8 +1103,13 @@ void CConnman::ThreadSocketHandler() } } } - if(vNodes.size() != nPrevNodeCount) { - nPrevNodeCount = vNodes.size(); + size_t vNodesSize; + { + LOCK(cs_vNodes); + vNodesSize = vNodes.size(); + } + if(vNodesSize != nPrevNodeCount) { + nPrevNodeCount = vNodesSize; if(clientInterface) clientInterface->NotifyNumConnectionsChanged(nPrevNodeCount); } |