core: use nm_gobject_notify_together() in NMIP4Config/NMIP6Config

nm_gobject_notify_together() freezes the notifications to emit both
notification signals together. That matters for NMDBusObject base
class, which hooks into dispatch_properties_changed() to emit a combined
"PropertiesChanged" signal.

Note, that during calls like nm_ip4_config_replace(), we already
froze/thawed the notifications. So, this change adds unnecessary
freeze/thaw calls, because signal emition is already frozen.
That is a bit ugly, because g_object_freeze_notify() is more heavy
than I'd wish it would be.

Anyway, for other places, like nm_ip4_config_reset_routes() that is
not the case. And correctness trumps performance.

Ultimately, the issue there is that we use NMIP4Config / NMIP6Config
both to track internal configuration, and to expose it on D-Bus.
The majority of created NMIP4Config / NMIP6Config instances won't get
exported, and but still pay an unnecessary overhead. The proper solution
to minimize the overhead would be, to separate these uses.
This commit is contained in:
Thomas Haller 2018-07-14 17:18:58 +02:00
parent ccf6bdb0e2
commit 62a4f2652f
2 changed files with 8 additions and 8 deletions

View file

@ -509,8 +509,8 @@ _notify_addresses (NMIP4Config *self)
nm_clear_g_variant (&priv->address_data_variant);
nm_clear_g_variant (&priv->addresses_variant);
_notify (self, PROP_ADDRESS_DATA);
_notify (self, PROP_ADDRESSES);
nm_gobject_notify_together (self, PROP_ADDRESS_DATA,
PROP_ADDRESSES);
}
static void
@ -521,8 +521,8 @@ _notify_routes (NMIP4Config *self)
nm_assert (priv->best_default_route == _nm_ip4_config_best_default_route_find (self));
nm_clear_g_variant (&priv->route_data_variant);
nm_clear_g_variant (&priv->routes_variant);
_notify (self, PROP_ROUTE_DATA);
_notify (self, PROP_ROUTES);
nm_gobject_notify_together (self, PROP_ROUTE_DATA,
PROP_ROUTES);
}
/*****************************************************************************/

View file

@ -208,8 +208,8 @@ _notify_addresses (NMIP6Config *self)
nm_clear_g_variant (&priv->address_data_variant);
nm_clear_g_variant (&priv->addresses_variant);
_notify (self, PROP_ADDRESS_DATA);
_notify (self, PROP_ADDRESSES);
nm_gobject_notify_together (self, PROP_ADDRESS_DATA,
PROP_ADDRESSES);
}
static void
@ -220,8 +220,8 @@ _notify_routes (NMIP6Config *self)
nm_assert (priv->best_default_route == _nm_ip6_config_best_default_route_find (self));
nm_clear_g_variant (&priv->route_data_variant);
nm_clear_g_variant (&priv->routes_variant);
_notify (self, PROP_ROUTE_DATA);
_notify (self, PROP_ROUTES);
nm_gobject_notify_together (self, PROP_ROUTE_DATA,
PROP_ROUTES);
}
/*****************************************************************************/