summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-12-13 22:08:23 +0100
committerBeniamino Galvani <bgalvani@redhat.com>2016-01-07 11:52:52 +0100
commit44789e32912c48358dbb7971be57682bd330719d (patch)
tree8e8d68b5cc1c309d3743b5e77a4df5bbae41a0a8
parent06e0595401e6eb16ac527e54af8ca09c72245672 (diff)
downloadNetworkManager-44789e32912c48358dbb7971be57682bd330719d.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").
-rw-r--r--src/devices/nm-device.c11
-rw-r--r--src/nm-manager.c17
2 files changed, 5 insertions, 23 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 71b5ef0470..51b0c6f518 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -89,7 +89,6 @@ enum {
REMOVED,
RECHECK_AUTO_ACTIVATE,
RECHECK_ASSUME,
- LINK_INITIALIZED,
LAST_SIGNAL,
};
static guint signals[LAST_SIGNAL] = { 0 };
@@ -1589,9 +1588,6 @@ device_link_changed (NMDevice *self)
}
}
- if (just_initialized)
- g_signal_emit (self, signals[LINK_INITIALIZED], 0);
-
device_recheck_slave_status (self, &info);
return G_SOURCE_REMOVE;
}
@@ -10897,13 +10893,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_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_SKELETON,
"Disconnect", impl_device_disconnect,
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 623338a5b2..750c58b310 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -721,6 +721,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:
@@ -733,6 +734,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,
@@ -859,14 +864,6 @@ device_removed_cb (NMDevice *device, gpointer user_data)
remove_device (NM_MANAGER (user_data), device, FALSE, TRUE);
}
-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);
-}
-
NMState
nm_manager_get_state (NMManager *manager)
{
@@ -1830,10 +1827,6 @@ add_device (NMManager *self, NMDevice *device, GError **error)
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, NM_DEVICE_RECHECK_ASSUME,
G_CALLBACK (recheck_assume_connection_cb),
self);