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").

(cherry picked from commit 44789e3291)
This commit is contained in:
Beniamino Galvani 2015-12-13 22:08:23 +01:00
parent 49107121ab
commit 958ac50182
2 changed files with 5 additions and 23 deletions

View file

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

View file

@ -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,
@ -852,14 +857,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);
}
static void
aipd_handle_event (DBusGProxy *proxy,
const char *event,
@ -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);