Show valid node count
This commit is contained in:
parent
9065cde02c
commit
91922e83ea
@ -88,6 +88,21 @@ namespace Components
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int Node::GetValidNodeCount()
|
||||||
|
{
|
||||||
|
unsigned int count = 0;
|
||||||
|
|
||||||
|
for (auto node : Node::Nodes)
|
||||||
|
{
|
||||||
|
if (node.state == Node::STATE_VALID)
|
||||||
|
{
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
void Node::AddNode(Network::Address address)
|
void Node::AddNode(Network::Address address)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -701,7 +716,7 @@ namespace Components
|
|||||||
|
|
||||||
Command::Add("listnodes", [] (Command::Params params)
|
Command::Add("listnodes", [] (Command::Params params)
|
||||||
{
|
{
|
||||||
Logger::Print("Nodes: %d\n", Node::Nodes.size());
|
Logger::Print("Nodes: %d (%d)\n", Node::Nodes.size(), Node::GetValidNodeCount());
|
||||||
|
|
||||||
for (auto node : Node::Nodes)
|
for (auto node : Node::Nodes)
|
||||||
{
|
{
|
||||||
|
@ -20,6 +20,8 @@ namespace Components
|
|||||||
static void SyncNodeList();
|
static void SyncNodeList();
|
||||||
static void AddNode(Network::Address address);
|
static void AddNode(Network::Address address);
|
||||||
|
|
||||||
|
static unsigned int GetValidNodeCount();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum EntryState
|
enum EntryState
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user