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 b3b0b46250 ("device: retry creation of
default connection after link is initialized").
This commit is contained in:
Beniamino Galvani 2015-12-13 22:08:23 +01:00
parent 06e0595401
commit 44789e3291
2 changed files with 5 additions and 23 deletions

View file

@ -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,

View file

@ -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);