Calculate total clients if necessary

This commit is contained in:
Julian Kornberger 2016-07-13 16:50:59 +02:00
parent 4a9b78367c
commit 6450ae05a5

View File

@ -111,9 +111,14 @@ func (nodes *Nodes) GetNodesMini() *meshviewer.Nodes {
meshviewerNodes.List[nodeID] = node
}
// Calculate Total
total := nodeOrigin.Statistics.Clients.Total
if total == 0 {
total = nodeOrigin.Statistics.Clients.Wifi24 + nodeOrigin.Statistics.Clients.Wifi5
}
node.Statistics = &meshviewer.Statistics{
NodeId: nodeOrigin.Statistics.NodeId,
Clients: nodeOrigin.Statistics.Clients.Total,
Gateway: nodeOrigin.Statistics.Gateway,
RootFsUsage: nodeOrigin.Statistics.RootFsUsage,
LoadAverage: nodeOrigin.Statistics.LoadAverage,
@ -123,6 +128,7 @@ func (nodes *Nodes) GetNodesMini() *meshviewer.Nodes {
Processes: nodeOrigin.Statistics.Processes,
MeshVpn: nodeOrigin.Statistics.MeshVpn,
Traffic: nodeOrigin.Statistics.Traffic,
Clients: total,
}
}
return meshviewerNodes