mirror of
https://github.com/gravitl/netmaker.git
synced 2025-11-03 11:02:11 +08:00
adjusted check for clients on non servers
This commit is contained in:
@@ -83,6 +83,7 @@ func CollectServerMetrics(serverID string, networkNodes []models.Node) *models.M
|
|||||||
TotalReceived: peers[j].ReceiveBytes,
|
TotalReceived: peers[j].ReceiveBytes,
|
||||||
TotalSent: peers[j].TransmitBytes,
|
TotalSent: peers[j].TransmitBytes,
|
||||||
Connected: true,
|
Connected: true,
|
||||||
|
Latency: -1, // can not determine latency on server currently
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newServerMetrics.Connectivity[clients[i].ClientID] = models.Metric{
|
newServerMetrics.Connectivity[clients[i].ClientID] = models.Metric{
|
||||||
|
|||||||
@@ -242,7 +242,8 @@ func updateNodeMetrics(currentNode *models.Node, newMetrics *models.Metrics) boo
|
|||||||
// associate ext clients with IDs
|
// associate ext clients with IDs
|
||||||
for i := range attachedClients {
|
for i := range attachedClients {
|
||||||
extMetric := newMetrics.Connectivity[attachedClients[i].PublicKey]
|
extMetric := newMetrics.Connectivity[attachedClients[i].PublicKey]
|
||||||
if len(extMetric.NodeName) == 0 { // cover server clients
|
if len(extMetric.NodeName) == 0 &&
|
||||||
|
len(newMetrics.Connectivity[attachedClients[i].ClientID].NodeName) > 1 { // cover server clients
|
||||||
extMetric = newMetrics.Connectivity[attachedClients[i].ClientID]
|
extMetric = newMetrics.Connectivity[attachedClients[i].ClientID]
|
||||||
if extMetric.TotalReceived > 0 && extMetric.TotalSent > 0 {
|
if extMetric.TotalReceived > 0 && extMetric.TotalSent > 0 {
|
||||||
extMetric.Connected = true
|
extMetric.Connected = true
|
||||||
|
|||||||
Reference in New Issue
Block a user