diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2015-12-13 22:08:23 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2016-01-11 14:56:48 +0100 |
commit | 958ac50182e9e9211c4cbc1f9b0f5e72e4e9a2e7 (patch) | |
tree | e4eecf03eea5c4450bfbcde59aa236e2cb85f14c | |
parent | 49107121ab03be766f3f930333cc4b362d40c7ea (diff) | |
download | NetworkManager-958ac50182e9e9211c4cbc1f9b0f5e72e4e9a2e7.tar.gz |
core: simplify generation of default connection for new devices
Instead of using a signal for triggering the generation of a default
connection when the device becomes managed, let the manager wait for a
transition to UNAVAILABLE or DISCONNECTED states.
This partially reverts b3b0b4625053 ("device: retry creation of
default connection after link is initialized").
(cherry picked from commit 44789e32912c48358dbb7971be57682bd330719d)
-rw-r--r-- | src/devices/nm-device.c | 11 | ||||
-rw-r--r-- | src/nm-manager.c | 17 |
2 files changed, 5 insertions, 23 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 4413e92836..c59c8f61ab 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -95,7 +95,6 @@ enum { REMOVED, RECHECK_AUTO_ACTIVATE, RECHECK_ASSUME, - LINK_INITIALIZED, LAST_SIGNAL, }; static guint signals[LAST_SIGNAL] = { 0 }; @@ -1515,9 +1514,6 @@ device_link_changed (NMDevice *self) } } - if (emit_link_initialized) - g_signal_emit (self, signals[LINK_INITIALIZED], 0); - return G_SOURCE_REMOVE; } @@ -9879,13 +9875,6 @@ nm_device_class_init (NMDeviceClass *klass) 0, NULL, NULL, NULL, G_TYPE_NONE, 0); - signals[LINK_INITIALIZED] = - g_signal_new (NM_DEVICE_LINK_INITIALIZED, - G_OBJECT_CLASS_TYPE (object_class), - G_SIGNAL_RUN_FIRST, - 0, NULL, NULL, NULL, - G_TYPE_NONE, 0); - nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_object_info); diff --git a/src/nm-manager.c b/src/nm-manager.c index a1e4fb4f17..26e2127354 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -717,6 +717,7 @@ manager_device_state_changed (NMDevice *device, gpointer user_data) { NMManager *self = NM_MANAGER (user_data); + NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); switch (new_state) { case NM_DEVICE_STATE_UNMANAGED: @@ -729,6 +730,10 @@ manager_device_state_changed (NMDevice *device, default: break; } + + if ( new_state == NM_DEVICE_STATE_UNAVAILABLE + || new_state == NM_DEVICE_STATE_DISCONNECTED) + nm_settings_device_added (priv->settings, device); } static void device_has_pending_action_changed (NMDevice *device, @@ -853,14 +858,6 @@ device_removed_cb (NMDevice *device, gpointer user_data) } static void -device_link_initialized_cb (NMDevice *device, gpointer user_data) -{ - NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (user_data); - - nm_settings_device_added (priv->settings, device); -} - -static void aipd_handle_event (DBusGProxy *proxy, const char *event, const char *iface, @@ -1821,10 +1818,6 @@ add_device (NMManager *self, NMDevice *device, gboolean try_assume) G_CALLBACK (device_removed_cb), self); - g_signal_connect (device, NM_DEVICE_LINK_INITIALIZED, - G_CALLBACK (device_link_initialized_cb), - self); - g_signal_connect (device, "notify::" NM_DEVICE_IP_IFACE, G_CALLBACK (device_ip_iface_changed), self); |