refactor: Apply consistent pattern for CAddrMan::Check usage

Co-authored-by: John Newbery <john@johnnewbery.com>
This commit is contained in:
Hennadii StepanovandJohn Newbery committed 2021-06-14 17:28:37 +03:00
1 parent 187b7d2bb3
commit f79a664314
1 file changed
+8 -14
+8 -14
View File
@@ -551,13 +551,10 @@ public:
//! Randomly select an address in tried that another address is attempting to evict. //! Randomly select an address in tried that another address is attempting to evict.
CAddrInfo SelectTriedCollision() CAddrInfo SelectTriedCollision()
{ {
CAddrInfo ret; LOCK(cs);
{ Check();
LOCK(cs); const CAddrInfo ret = SelectTriedCollision_();
Check(); Check();
ret = SelectTriedCollision_();
Check();
}
return ret; return ret;
} }
@@ -566,13 +563,10 @@ public:
*/ */
CAddrInfo Select(bool newOnly = false) CAddrInfo Select(bool newOnly = false)
{ {
CAddrInfo addrRet; LOCK(cs);
{ Check();
LOCK(cs); const CAddrInfo addrRet = Select_(newOnly);
Check(); Check();
addrRet = Select_(newOnly);
Check();
}
return addrRet; return addrRet;
} }