@@ -614,7 +614,7 @@ bool AddrManImpl::AddSingle(const CAddress& addr, const CNetAddr& source, int64_
614
614
return fInsert ;
615
615
}
616
616
617
- void AddrManImpl::Good_ (const CService& addr, bool test_before_evict, int64_t nTime)
617
+ bool AddrManImpl::Good_ (const CService& addr, bool test_before_evict, int64_t nTime)
618
618
{
619
619
AssertLockHeld (cs);
620
620
@@ -625,8 +625,7 @@ void AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
625
625
AddrInfo* pinfo = Find (addr, &nId);
626
626
627
627
// if not found, bail out
628
- if (!pinfo)
629
- return ;
628
+ if (!pinfo) return false ;
630
629
631
630
AddrInfo& info = *pinfo;
632
631
@@ -638,13 +637,11 @@ void AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
638
637
// currently-connected peers.
639
638
640
639
// if it is already in the tried set, don't do anything else
641
- if (info.fInTried )
642
- return ;
640
+ if (info.fInTried ) return false ;
643
641
644
642
// if it is not in new, something bad happened
645
- if (!Assume (info.nRefCount > 0 )) {
646
- return ;
647
- }
643
+ if (!Assume (info.nRefCount > 0 )) return false ;
644
+
648
645
649
646
// which tried bucket to move the entry to
650
647
int tried_bucket = info.GetTriedBucket (nKey, m_asmap);
@@ -661,11 +658,13 @@ void AddrManImpl::Good_(const CService& addr, bool test_before_evict, int64_t nT
661
658
colliding_entry != mapInfo.end () ? colliding_entry->second .ToString () : " " ,
662
659
addr.ToString (),
663
660
m_tried_collisions.size ());
661
+ return false ;
664
662
} else {
665
663
// move nId to the tried tables
666
664
MakeTried (info, nId);
667
665
LogPrint (BCLog::ADDRMAN, " Moved %s mapped to AS%i to tried[%i][%i]\n " ,
668
666
addr.ToString (), addr.GetMappedAS (m_asmap), tried_bucket, tried_bucket_pos);
667
+ return true ;
669
668
}
670
669
}
671
670
@@ -1049,12 +1048,13 @@ bool AddrManImpl::Add(const std::vector<CAddress>& vAddr, const CNetAddr& source
1049
1048
return ret;
1050
1049
}
1051
1050
1052
- void AddrManImpl::Good (const CService& addr, int64_t nTime)
1051
+ bool AddrManImpl::Good (const CService& addr, int64_t nTime)
1053
1052
{
1054
1053
LOCK (cs);
1055
1054
Check ();
1056
- Good_ (addr, /* test_before_evict */ true , nTime);
1055
+ auto ret = Good_ (addr, /* test_before_evict= */ true , nTime);
1057
1056
Check ();
1057
+ return ret;
1058
1058
}
1059
1059
1060
1060
void AddrManImpl::Attempt (const CService& addr, bool fCountFailure , int64_t nTime)
@@ -1157,9 +1157,9 @@ bool AddrMan::Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, in
1157
1157
return m_impl->Add (vAddr, source, nTimePenalty);
1158
1158
}
1159
1159
1160
- void AddrMan::Good (const CService& addr, int64_t nTime)
1160
+ bool AddrMan::Good (const CService& addr, int64_t nTime)
1161
1161
{
1162
- m_impl->Good (addr, nTime);
1162
+ return m_impl->Good (addr, nTime);
1163
1163
}
1164
1164
1165
1165
void AddrMan::Attempt (const CService& addr, bool fCountFailure , int64_t nTime)
0 commit comments