From 62a4f2652f6a6a4ec4fa42260b4cb40e38752a0f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 14 Jul 2018 17:18:58 +0200 Subject: [PATCH] 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. --- src/nm-ip4-config.c | 8 ++++---- src/nm-ip6-config.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/nm-ip4-config.c b/src/nm-ip4-config.c index 7cb21a7d07..60bac978eb 100644 --- a/src/nm-ip4-config.c +++ b/src/nm-ip4-config.c @@ -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); } /*****************************************************************************/ diff --git a/src/nm-ip6-config.c b/src/nm-ip6-config.c index f0769c1527..b166e98f73 100644 --- a/src/nm-ip6-config.c +++ b/src/nm-ip6-config.c @@ -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); } /*****************************************************************************/