@@ -2697,7 +2697,7 @@ bool CConnman::ForNode(NodeId id, std::function<bool(CNode* pnode)> func)
26972697 return found != nullptr && func (found);
26982698}
26992699
2700- bool CConnman::ForEachNode (std::function<bool (CNode* pnode)> func)
2700+ bool CConnman::ForEachNodeContinueIf (std::function<bool (CNode* pnode)> func)
27012701{
27022702 LOCK (cs_vNodes);
27032703 for (auto && node : vNodes)
@@ -2706,7 +2706,7 @@ bool CConnman::ForEachNode(std::function<bool(CNode* pnode)> func)
27062706 return true ;
27072707}
27082708
2709- bool CConnman::ForEachNode (std::function<bool (const CNode* pnode)> func) const
2709+ bool CConnman::ForEachNodeContinueIf (std::function<bool (const CNode* pnode)> func) const
27102710{
27112711 LOCK (cs_vNodes);
27122712 for (const auto & node : vNodes)
@@ -2715,7 +2715,7 @@ bool CConnman::ForEachNode(std::function<bool(const CNode* pnode)> func) const
27152715 return true ;
27162716}
27172717
2718- bool CConnman::ForEachNodeThen (std::function<bool (CNode* pnode)> pre, std::function<void()> post)
2718+ bool CConnman::ForEachNodeContinueIfThen (std::function<bool (CNode* pnode)> pre, std::function<void()> post)
27192719{
27202720 bool ret = true ;
27212721 LOCK (cs_vNodes);
@@ -2728,7 +2728,7 @@ bool CConnman::ForEachNodeThen(std::function<bool(CNode* pnode)> pre, std::funct
27282728 return ret;
27292729}
27302730
2731- bool CConnman::ForEachNodeThen (std::function<bool (const CNode* pnode)> pre, std::function<void()> post) const
2731+ bool CConnman::ForEachNodeContinueIfThen (std::function<bool (const CNode* pnode)> pre, std::function<void()> post) const
27322732{
27332733 bool ret = true ;
27342734 LOCK (cs_vNodes);
@@ -2741,6 +2741,35 @@ bool CConnman::ForEachNodeThen(std::function<bool(const CNode* pnode)> pre, std:
27412741 return ret;
27422742}
27432743
2744+ void CConnman::ForEachNode (std::function<void (CNode* pnode)> func)
2745+ {
2746+ LOCK (cs_vNodes);
2747+ for (auto && node : vNodes)
2748+ func (node);
2749+ }
2750+
2751+ void CConnman::ForEachNode (std::function<void (const CNode* pnode)> func) const
2752+ {
2753+ LOCK (cs_vNodes);
2754+ for (const auto & node : vNodes)
2755+ func (node);
2756+ }
2757+
2758+ void CConnman::ForEachNodeThen (std::function<void (CNode* pnode)> pre, std::function<void()> post)
2759+ {
2760+ LOCK (cs_vNodes);
2761+ for (auto && node : vNodes)
2762+ pre (node);
2763+ post ();
2764+ }
2765+
2766+ void CConnman::ForEachNodeThen (std::function<void (const CNode* pnode)> pre, std::function<void()> post) const
2767+ {
2768+ LOCK (cs_vNodes);
2769+ for (const auto & node : vNodes)
2770+ pre (node);
2771+ post ();
2772+ }
27442773int64_t PoissonNextSend (int64_t nNow, int average_interval_seconds) {
27452774 return nNow + (int64_t )(log1p (GetRand (1ULL << 48 ) * -0.0000000000000035527136788 /* -1/2^48 */ ) * average_interval_seconds * -1000000.0 + 0.5 );
27462775}
0 commit comments