aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2017-11-07 10:35:09 -0500
committerMarcoFalke <falke.marco@gmail.com>2017-11-07 10:35:12 -0500
commit5aeaa9ccd1568a77e075dbe2bd2435bd60c87c91 (patch)
treedf07f19af7899b586eca846dc69cab8a7b006b22 /src
parentffc0b11503a980ac2c9053b51822512c954f54df (diff)
parent3ab545d7f8e979e2cabeff6f5f6f1afe94a5c195 (diff)
downloadbitcoin-5aeaa9ccd1568a77e075dbe2bd2435bd60c87c91.tar.xz
Merge #11585: addrman: Add missing lock in Clear() (CAddrMan)
3ab545d7f addrman: Add missing lock in Clear() (CAddrMan) (practicalswift) Pull request description: Add missing lock in `Clear()` (`CAddrMan`). The variable `vRandom` is guarded by the mutex `cs`. **Note to reviewers:** Does this look correct? Should the lock cover the entire scope of the method, or should it be limited to cover only `std::vector<int>().swap(vRandom);`? Tree-SHA512: 8833f31beaed1728fa55b13ddf9e0b8e24e395931497329be2440ce1c5113ff02871707d40830260adabd30c4ea86088f5da5cf8a821150c0d820f50a2ce386a
Diffstat (limited to 'src')
-rw-r--r--src/addrman.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/addrman.h b/src/addrman.h
index 18f3062287..f347cba6ca 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -455,6 +455,7 @@ public:
void Clear()
{
+ LOCK(cs);
std::vector<int>().swap(vRandom);
nKey = GetRandHash();
for (size_t bucket = 0; bucket < ADDRMAN_NEW_BUCKET_COUNT; bucket++) {