@@ -231,6 +231,7 @@ class CAddrMan
231
231
*/
232
232
template <typename Stream>
233
233
void Serialize (Stream& s_) const
234
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
234
235
{
235
236
LOCK (cs);
236
237
@@ -296,6 +297,7 @@ class CAddrMan
296
297
297
298
template <typename Stream>
298
299
void Unserialize (Stream& s_)
300
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
299
301
{
300
302
LOCK (cs);
301
303
@@ -452,6 +454,7 @@ class CAddrMan
452
454
}
453
455
454
456
void Clear ()
457
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
455
458
{
456
459
LOCK (cs);
457
460
std::vector<int >().swap (vRandom);
@@ -487,13 +490,15 @@ class CAddrMan
487
490
488
491
// ! Return the number of (unique) addresses in all tables.
489
492
size_t size () const
493
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
490
494
{
491
495
LOCK (cs); // TODO: Cache this in an atomic to avoid this overhead
492
496
return vRandom.size ();
493
497
}
494
498
495
499
// ! Add a single address.
496
500
bool Add (const CAddress &addr, const CNetAddr& source, int64_t nTimePenalty = 0 )
501
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
497
502
{
498
503
LOCK (cs);
499
504
bool fRet = false ;
@@ -508,6 +513,7 @@ class CAddrMan
508
513
509
514
// ! Add multiple addresses.
510
515
bool Add (const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t nTimePenalty = 0 )
516
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
511
517
{
512
518
LOCK (cs);
513
519
int nAdd = 0 ;
@@ -523,6 +529,7 @@ class CAddrMan
523
529
524
530
// ! Mark an entry as accessible.
525
531
void Good (const CService &addr, bool test_before_evict = true , int64_t nTime = GetAdjustedTime())
532
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
526
533
{
527
534
LOCK (cs);
528
535
Check ();
@@ -532,6 +539,7 @@ class CAddrMan
532
539
533
540
// ! Mark an entry as connection attempted to.
534
541
void Attempt (const CService &addr, bool fCountFailure , int64_t nTime = GetAdjustedTime())
542
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
535
543
{
536
544
LOCK (cs);
537
545
Check ();
@@ -541,6 +549,7 @@ class CAddrMan
541
549
542
550
// ! See if any to-be-evicted tried table entries have been tested and if so resolve the collisions.
543
551
void ResolveCollisions ()
552
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
544
553
{
545
554
LOCK (cs);
546
555
Check ();
@@ -550,6 +559,7 @@ class CAddrMan
550
559
551
560
// ! Randomly select an address in tried that another address is attempting to evict.
552
561
CAddrInfo SelectTriedCollision ()
562
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
553
563
{
554
564
LOCK (cs);
555
565
Check ();
@@ -562,6 +572,7 @@ class CAddrMan
562
572
* Choose an address to connect to.
563
573
*/
564
574
CAddrInfo Select (bool newOnly = false )
575
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
565
576
{
566
577
LOCK (cs);
567
578
Check ();
@@ -578,6 +589,7 @@ class CAddrMan
578
589
* @param[in] network Select only addresses of this network (nullopt = all).
579
590
*/
580
591
std::vector<CAddress> GetAddr (size_t max_addresses, size_t max_pct, std::optional<Network> network)
592
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
581
593
{
582
594
LOCK (cs);
583
595
Check ();
@@ -589,6 +601,7 @@ class CAddrMan
589
601
590
602
// ! Outer function for Connected_()
591
603
void Connected (const CService &addr, int64_t nTime = GetAdjustedTime())
604
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
592
605
{
593
606
LOCK (cs);
594
607
Check ();
@@ -597,6 +610,7 @@ class CAddrMan
597
610
}
598
611
599
612
void SetServices (const CService &addr, ServiceFlags nServices)
613
+ EXCLUSIVE_LOCKS_REQUIRED(!cs)
600
614
{
601
615
LOCK (cs);
602
616
Check ();
0 commit comments