diff options
author | Dan Williams <dcbw@redhat.com> | 2014-10-21 19:43:34 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-11-06 20:51:58 -0600 |
commit | 648270d46939aa7de8a87f4b2b63b92f5fb5278b (patch) | |
tree | c6e628c9b5521cd1dc699535bd5d9f71accd558a /libnm/nm-remote-settings.c | |
parent | 098d655ef148445dedc23aea6d014881889b364f (diff) | |
download | NetworkManager-648270d46939aa7de8a87f4b2b63b92f5fb5278b.tar.gz |
libnm: cancel NMRemoteSettings/NMManager property reload when NM quits
If the operation isn't canceled it returns an error, printing this:
/libnm/client-nm-running:
(/home/dcbw/Development/fdo/NetworkManager/libnm/tests/.libs/lt-test-nm-client:17983): libnm-WARNING **: updated_properties: error reading NMRemoteSettings properties: GDBus.Error:org.freedesktop.DBus.Error.NoReply: Message did not receive a reply (timeout by message bus)
/bin/sh: line 5: 17983 Trace/breakpoint trap ./libnm-test-launch.sh ${dir}$tst
FAIL: test-nm-client
which screws up testcases because they don't expect this message.
And in this case, since libnm knows that NM is exiting and will
just clear out the properties anyway, it's useless to print the message.
Diffstat (limited to 'libnm/nm-remote-settings.c')
-rw-r--r-- | libnm/nm-remote-settings.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libnm/nm-remote-settings.c b/libnm/nm-remote-settings.c index a37cbe9f8b..754fbe1303 100644 --- a/libnm/nm-remote-settings.c +++ b/libnm/nm-remote-settings.c @@ -44,6 +44,7 @@ typedef struct { NMDBusSettings *proxy; GPtrArray *all_connections; GPtrArray *visible_connections; + GCancellable *props_cancellable; /* AddConnectionInfo objects that are waiting for the connection to become initialized */ GSList *add_list; @@ -604,7 +605,8 @@ updated_properties (GObject *object, GAsyncResult *result, gpointer user_data) GError *error = NULL; if (!_nm_object_reload_properties_finish (NM_OBJECT (object), result, &error)) { - g_warning ("%s: error reading NMRemoteSettings properties: %s", __func__, error->message); + if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + g_warning ("%s: error reading NMRemoteSettings properties: %s", __func__, error->message); g_error_free (error); } } @@ -623,6 +625,8 @@ nm_running_changed (GObject *object, GPtrArray *connections; int i; + NM_UTILS_CLEAR_CANCELLABLE (priv->props_cancellable); + /* Clear connections */ connections = priv->all_connections; priv->all_connections = g_ptr_array_new (); @@ -645,7 +649,10 @@ nm_running_changed (GObject *object, _nm_object_suppress_property_updates (NM_OBJECT (self), TRUE); } else { _nm_object_suppress_property_updates (NM_OBJECT (self), FALSE); - _nm_object_reload_properties_async (NM_OBJECT (self), updated_properties, self); + + NM_UTILS_CLEAR_CANCELLABLE (priv->props_cancellable); + priv->props_cancellable = g_cancellable_new (); + _nm_object_reload_properties_async (NM_OBJECT (self), priv->props_cancellable, updated_properties, self); } g_object_thaw_notify (object); |