From e9b84221de7d8fe0aae39f0946d1c1473bc45949 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 20 Jul 2020 14:54:15 +0200 Subject: [PATCH] device: emit rx-bytes/tx-bytes change notification together This also groups the PropertiesChanged signal on D-Bus. --- src/devices/nm-device.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 90ca3eddd5..797de61488 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -2197,17 +2197,23 @@ _stats_update_counters (NMDevice *self, guint64 rx_bytes) { NMDevicePrivate *priv; + gboolean tx_changed = FALSE; + gboolean rx_changed = FALSE; priv = NM_DEVICE_GET_PRIVATE (self); if (priv->stats.tx_bytes != tx_bytes) { priv->stats.tx_bytes = tx_bytes; - _notify (self, PROP_STATISTICS_TX_BYTES); + tx_changed = TRUE; } if (priv->stats.rx_bytes != rx_bytes) { priv->stats.rx_bytes = rx_bytes; - _notify (self, PROP_STATISTICS_RX_BYTES); + rx_changed = TRUE; } + + nm_gobject_notify_together (self, + tx_changed ? PROP_STATISTICS_TX_BYTES : PROP_0, + rx_changed ? PROP_STATISTICS_RX_BYTES : PROP_0); } static void