File tree 1 file changed +9
-9
lines changed 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -922,24 +922,24 @@ static bool CompareNodeTXTime(const NodeEvictionCandidate &a, const NodeEviction
922
922
*/
923
923
bool CConnman::AttemptToEvictConnection ()
924
924
{
925
- std::vector<NodeEvictionCandidate> vEvictionCandidates ;
925
+ std::vector<CNode*> vNodesCopy ;
926
926
{
927
927
LOCK (cs_vNodes);
928
-
929
- BOOST_FOREACH (CNode *node, vNodes) {
930
- if (node->fWhitelisted )
931
- continue ;
932
- if (!node->fInbound )
933
- continue ;
934
- if (node->fDisconnect )
935
- continue ;
928
+ vNodesCopy = vNodes;
929
+ for (CNode* pnode : vNodes)
930
+ pnode->AddRef ();
931
+ }
932
+ std::vector<NodeEvictionCandidate> vEvictionCandidates;
933
+ for (CNode* node : vNodesCopy) {
934
+ if (!node->fWhitelisted && node->fInbound && node->fDisconnect ) {
936
935
LOCK (node->cs_filter );
937
936
NodeEvictionCandidate candidate = {node->id , node->nTimeConnected , node->nMinPingUsecTime ,
938
937
node->nLastBlockTime , node->nLastTXTime ,
939
938
(node->nServices & nRelevantServices) == nRelevantServices,
940
939
node->fRelayTxes , node->pfilter != NULL , node->addr , node->nKeyedNetGroup };
941
940
vEvictionCandidates.push_back (candidate);
942
941
}
942
+ node->Release ();
943
943
}
944
944
945
945
if (vEvictionCandidates.empty ()) return false ;
You can’t perform that action at this time.
0 commit comments