Browse Source

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
0.16
MarcoFalke 7 years ago
parent
commit
5aeaa9ccd1
No known key found for this signature in database
GPG Key ID: D2EA4850E7528B25
  1. 1
      src/addrman.h

1
src/addrman.h

@ -455,6 +455,7 @@ public:
void Clear() void Clear()
{ {
LOCK(cs);
std::vector<int>().swap(vRandom); std::vector<int>().swap(vRandom);
nKey = GetRandHash(); nKey = GetRandHash();
for (size_t bucket = 0; bucket < ADDRMAN_NEW_BUCKET_COUNT; bucket++) { for (size_t bucket = 0; bucket < ADDRMAN_NEW_BUCKET_COUNT; bucket++) {

Loading…
Cancel
Save