Show valid node count

This commit is contained in:
momo5502 2016-03-09 20:16:38 +01:00
parent 9065cde02c
commit 91922e83ea
2 changed files with 18 additions and 1 deletions

View File

@ -88,6 +88,21 @@ namespace Components
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)
{
#ifdef DEBUG
@ -701,7 +716,7 @@ namespace Components
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)
{

View File

@ -20,6 +20,8 @@ namespace Components
static void SyncNodeList();
static void AddNode(Network::Address address);
static unsigned int GetValidNodeCount();
private:
enum EntryState
{