From 45ac6d8c12efd264078928a0ffd2e4aeb8528cb5 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 27 Jan 2017 13:52:26 +0100 Subject: [PATCH] device: add pending-action "recheck-available" Startup-complete means that all devices have settled in a state and no further activation is pending. When we have a recheck-available scheduled, we clearly should not yet declare startup-complete. Add a new pending-action "recheck-available" to avoid: [1485520408.3920] device (wlp2s0): supplicant interface state: starting -> ready [1485520408.3920] device[0x563abbcca400] (wlp2s0): remove_pending_action (0): 'waiting for supplicant' [1485520408.3920] manager: startup complete [1485520408.3924] device[0x563abbcca400] (wlp2s0): add_pending_action (1): 'queued state change to disconnected' (cherry picked from commit 11744b090ea0f6e7d1f71c936e76588b4c7ea347) --- src/devices/nm-device.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index adce2fcf9c..28e798b867 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -143,6 +143,7 @@ NM_GOBJECT_PROPERTIES_DEFINE (NMDevice, #define PENDING_ACTION_DHCP4 "dhcp4" #define PENDING_ACTION_DHCP6 "dhcp6" #define PENDING_ACTION_AUTOCONF6 "autoconf6" +#define PENDING_ACTION_RECHECK_AVAILABLE "recheck-available" #define DHCP_RESTART_TIMEOUT 120 #define DHCP_NUM_TRIES_MAX 3 @@ -3921,6 +3922,9 @@ recheck_available (gpointer user_data) priv->recheck_available.unavailable_reason = NM_DEVICE_STATE_REASON_NONE; } + if (priv->recheck_available.call_id == 0) + nm_device_remove_pending_action (self, PENDING_ACTION_RECHECK_AVAILABLE, TRUE); + return G_SOURCE_REMOVE; } @@ -3933,8 +3937,12 @@ nm_device_queue_recheck_available (NMDevice *self, priv->recheck_available.available_reason = available_reason; priv->recheck_available.unavailable_reason = unavailable_reason; - if (!priv->recheck_available.call_id) + if (!priv->recheck_available.call_id) { priv->recheck_available.call_id = g_idle_add (recheck_available, self); + nm_device_add_pending_action (self, PENDING_ACTION_RECHECK_AVAILABLE, + FALSE /* cannot assert, because of how recheck_available() first clears + the call-id and postpones removing the pending-action. */); + } } void