diff options
author | Matt Corallo <git@bluematt.me> | 2016-11-25 19:29:55 -0800 |
---|---|---|
committer | Matt Corallo <git@bluematt.me> | 2016-11-26 15:42:55 -0800 |
commit | dfed983f19e7b61da243362f00fa3a14c92dae45 (patch) | |
tree | 3b4a4a38751cb63e48a9a02e0c3637c5c539e813 | |
parent | 303352286f2af0f12fd5ae7f65ad48330b5a00ec (diff) |
Fix unlocked access to vNodes.size()
-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 15c4514f15..233c0fbc80 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); } |