diff options
author | Thomas Haller <thaller@redhat.com> | 2015-10-06 12:03:51 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-10-06 17:35:13 +0200 |
commit | 7bbc090387d6a1c519c92d957f5746faffb9325c (patch) | |
tree | f8e732bf0994e013e8b18df70f90b3a6f9ae702f | |
parent | c5210b322dd3d5d26d3a3adb6d2ca67a3fc387e0 (diff) | |
download | NetworkManager-7bbc090387d6a1c519c92d957f5746faffb9325c.tar.gz |
device: handle master-ready before scheduling stage2
Don't handle master-ready at the beginning of stage2, but instead while
scheduling (and then possibly delaying the scheduling of stage2).
This seems more idiomatic:
When inside a stage and your part is done: call schedule-next-stage.
That is, always schedule the next stage, not the current one.
schedule-next-stage then might delay to really scheduling until the
device is ready for the next state.
Fixes: 85ac903bb8010409c4010ba09c621780b385b9b5
-rw-r--r-- | src/devices/nm-device.c | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 3bc6089f8c..a862fe47a4 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -2992,28 +2992,6 @@ nm_device_activate_stage2_device_config (gpointer user_data) /* Clear the activation source ID now that this stage has run */ activation_source_clear (self, FALSE, 0); - if (!priv->master_ready_handled) { - if (!nm_active_connection_get_master (active)) - priv->master_ready_handled = TRUE; - else { - /* If the master connection is ready for slaves, attach ourselves */ - if (nm_active_connection_get_master_ready (active)) - master_ready (self, active); - else { - _LOGD (LOGD_DEVICE, "waiting for master connection to become ready"); - - if (priv->master_ready_id == 0) { - priv->master_ready_id = g_signal_connect (active, - "notify::" NM_ACTIVE_CONNECTION_INT_MASTER_READY, - (GCallback) master_ready_cb, - self); - } - /* Postpone */ - return FALSE; - } - } - } - _LOGD (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) starting..."); nm_device_state_changed (self, NM_DEVICE_STATE_CONFIG, NM_DEVICE_STATE_REASON_NONE); @@ -3075,6 +3053,30 @@ nm_device_activate_schedule_stage2_device_config (NMDevice *self) priv = NM_DEVICE_GET_PRIVATE (self); g_return_if_fail (priv->act_request); + if (!priv->master_ready_handled) { + NMActiveConnection *active = NM_ACTIVE_CONNECTION (priv->act_request); + + if (!nm_active_connection_get_master (active)) + priv->master_ready_handled = TRUE; + else { + /* If the master connection is ready for slaves, attach ourselves */ + if (nm_active_connection_get_master_ready (active)) + master_ready (self, active); + else { + _LOGD (LOGD_DEVICE, "waiting for master connection to become ready"); + + if (priv->master_ready_id == 0) { + priv->master_ready_id = g_signal_connect (active, + "notify::" NM_ACTIVE_CONNECTION_INT_MASTER_READY, + (GCallback) master_ready_cb, + self); + } + /* Postpone */ + return; + } + } + } + activation_source_schedule (self, nm_device_activate_stage2_device_config, 0); _LOGD (LOGD_DEVICE, "Activation: Stage 2 of 5 (Device Configure) scheduled..."); |