mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-27 14:00:11 +01:00
device: reset device-stats in update_stats() on missing link
First of all, we don't expect missing NMPlatformLink instances. If that actually happens, just reset the counters to zero.
This commit is contained in:
parent
9c5405eba4
commit
fc2f1d9cb8
1 changed files with 7 additions and 4 deletions
|
|
@ -49,13 +49,16 @@ update_stats (gpointer user_data)
|
|||
|
||||
pllink = nm_platform_link_get (NM_PLATFORM_GET, ifindex);
|
||||
if (pllink) {
|
||||
_LOGT ("{RX} %"PRIu64" packets %"PRIu64" bytes {TX} %"PRIu64" packets %"PRIu64" bytes",
|
||||
pllink->rx_packets, pllink->rx_bytes, pllink->tx_packets, pllink->tx_bytes);
|
||||
_LOGT ("ifindex %d: {RX} %"PRIu64" packets %"PRIu64" bytes {TX} %"PRIu64" packets %"PRIu64" bytes",
|
||||
ifindex, pllink->rx_packets, pllink->rx_bytes, pllink->tx_packets, pllink->tx_bytes);
|
||||
|
||||
nm_device_set_tx_bytes (self->device, pllink->tx_bytes);
|
||||
nm_device_set_rx_bytes (self->device, pllink->rx_bytes);
|
||||
} else
|
||||
_LOGE ("error no stats available");
|
||||
} else {
|
||||
_LOGT ("error no stats available for ifindex %d", ifindex);
|
||||
nm_device_set_tx_bytes (self->device, 0);
|
||||
nm_device_set_rx_bytes (self->device, 0);
|
||||
}
|
||||
|
||||
/* Keep polling */
|
||||
nm_platform_link_refresh (NM_PLATFORM_GET, ifindex);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue