From 68d6d3c4ff4d3921408f7d9bab3e31e0e028a871 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 28 Oct 2015 14:29:08 -0700 Subject: Fix bug in peer count. --- node/Cluster.cpp | 2 +- node/Topology.cpp | 4 ++-- node/Topology.hpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/node/Cluster.cpp b/node/Cluster.cpp index 9b034822..e95f6acc 100644 --- a/node/Cluster.cpp +++ b/node/Cluster.cpp @@ -634,7 +634,7 @@ void Cluster::status(ZT_ClusterStatus &status) const ms[_id]->x = _x; ms[_id]->y = _y; ms[_id]->z = _z; - ms[_id]->peers = RR->topology->countAlive(); + ms[_id]->peers = RR->topology->countActive(); for(std::vector::const_iterator ep(_zeroTierPhysicalEndpoints.begin());ep!=_zeroTierPhysicalEndpoints.end();++ep) { if (ms[_id]->numZeroTierPhysicalEndpoints >= ZT_CLUSTER_MAX_ZT_PHYSICAL_ADDRESSES) // sanity check break; diff --git a/node/Topology.cpp b/node/Topology.cpp index 09668ef5..9027eff1 100644 --- a/node/Topology.cpp +++ b/node/Topology.cpp @@ -308,7 +308,7 @@ void Topology::clean(uint64_t now) } } -unsigned long Topology::countAlive() const +unsigned long Topology::countActive() const { const uint64_t now = RR->node->now(); unsigned long cnt = 0; @@ -317,7 +317,7 @@ unsigned long Topology::countAlive() const Address *a = (Address *)0; SharedPtr *p = (SharedPtr *)0; while (i.next(a,p)) { - if ((*p)->alive(now)) + if ((*p)->hasActiveDirectPath(now)) ++cnt; } return cnt; diff --git a/node/Topology.hpp b/node/Topology.hpp index 16836e07..b9f063c8 100644 --- a/node/Topology.hpp +++ b/node/Topology.hpp @@ -210,9 +210,9 @@ public: void clean(uint64_t now); /** - * @return Number of 'alive' peers + * @return Number of peers with active direct paths */ - unsigned long countAlive() const; + unsigned long countActive() const; /** * Apply a function or function object to all peers -- cgit v1.2.3