summaryrefslogtreecommitdiff
path: root/src/nm-manager.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-11-20 14:51:22 +0100
committerThomas Haller <thaller@redhat.com>2018-12-09 14:47:31 +0100
commitf95a5263667a03aaf67635d28532c242d3025bd9 (patch)
treea2602429f91cc2cba1693bdbc5a2e9e1e401fbc2 /src/nm-manager.c
parent9e8c3d2ebf2efd61658e69ef8c3db3df3b0b8f0a (diff)
downloadNetworkManager-f95a5263667a03aaf67635d28532c242d3025bd9.tar.gz
keep-alive: use NMKeepAlive API directly instead of via NMActiveConnection
NMKeepAlive is a proper GObject type, with a specific API that on the one end allows to configure watches/bindings, and on the other end exposes and is-alive property and the owner instance. That's great, as NMActiveConnection is not concerned with either end (moving complexity away from "nm-active-connection.c") and as we later can reuse NMKeepAlive with NMSettingsConnection. However, we don't need to wrap this API by NMActiveConnection. Doing so means, we need to expose all the watch/bind functions also as part of NMActiveConnection API. The only ugliness here is, that NMPolicy subscribes to property changed signal of the keep alive instance, which would fail horribly if NMActiveConnection ever decides to swap the keep alive instance (in which case NMPolicy would have to disconnect the signal, and possibly reconnect it to another NMKeepAlive instance). We avoid that by just not doing that and documenting it.
Diffstat (limited to 'src/nm-manager.c')
-rw-r--r--src/nm-manager.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 4c9b11a524..b05fbb443a 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -39,6 +39,7 @@
#include "platform/nm-platform.h"
#include "platform/nmp-object.h"
#include "nm-hostname-manager.h"
+#include "nm-keep-alive.h"
#include "nm-rfkill-manager.h"
#include "dhcp/nm-dhcp-manager.h"
#include "settings/nm-settings.h"
@@ -5378,8 +5379,13 @@ impl_manager_add_and_activate_connection (NMDBusObject *obj,
if (!active)
goto error;
- if (bind_dbus_client)
- nm_active_connection_bind_dbus_client (active, dbus_connection, sender);
+ if (bind_dbus_client) {
+ NMKeepAlive *keep_alive;
+
+ keep_alive = nm_active_connection_get_keep_alive (active);
+ nm_keep_alive_set_dbus_client_watch (keep_alive, dbus_connection, sender);
+ nm_keep_alive_arm (keep_alive);
+ }
nm_active_connection_authorize (active,
incompl_conn,