Filter out no bandwidth peers

This commit is contained in:
Owen
2026-01-16 17:54:05 -08:00
parent 060d876429
commit 91bfd69179

View File

@@ -1035,21 +1035,22 @@ func (s *WireGuardService) processPeerBandwidth(publicKey string, rxBytes, txByt
// Update the last reading
s.lastReadings[publicKey] = currentReading
// Only return bandwidth data if there was an increase
if bytesInDiff > 0 || bytesOutDiff > 0 {
return &PeerBandwidth{
PublicKey: publicKey,
BytesIn: bytesInMB,
BytesOut: bytesOutMB,
}
}
return nil
}
}
// For first reading or if readings are too close together, report 0
// For first reading or if readings are too close together, don't report
s.lastReadings[publicKey] = currentReading
return &PeerBandwidth{
PublicKey: publicKey,
BytesIn: 0,
BytesOut: 0,
}
return nil
}
func (s *WireGuardService) reportPeerBandwidth() error {