diff options
author | Thomas Haller <thaller@redhat.com> | 2018-07-14 17:18:58 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-07-25 17:26:30 +0200 |
commit | 6d3784876c05521aa3e0c48ff9320caea4d2cdc9 (patch) | |
tree | 2c6bb073a1c7f423a8ec58565ab6f3b135fca3c5 | |
parent | 31ea344e903466c37206b5a56d68e6d44ab08f82 (diff) | |
download | NetworkManager-6d3784876c05521aa3e0c48ff9320caea4d2cdc9.tar.gz |
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.
-rw-r--r-- | src/nm-ip4-config.c | 8 | ||||
-rw-r--r-- | 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); } /*****************************************************************************/ |