mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-03 08:10:17 +01:00
core: only run availability recheck transition if required
Device subclasses can call nm_device_recheck_available() at any time,
and the function would change the device's state to UNKNOWN in cases
where the device was available already. For WWAN devices, availability
is rechecked every time the modem state changes, resulting in:
NetworkManager[28919]: <info> (ttyUSB4): modem state changed, 'disabled' --> 'enabling' (reason: user-requested)
NetworkManager[28919]: <debug> [1445538582.116727] [devices/nm-device.c:2769] recheck_available(): [0x23bd710] (ttyUSB4): device is available, will transition to unknown
NetworkManager[28919]: <info> (ttyUSB4): modem state changed, 'enabling' --> 'searching' (reason: user-requested)
NetworkManager[28919]: <debug> [1445538582.776317] [devices/nm-device.c:2769] recheck_available(): [0x23bd710] (ttyUSB4): device is available, will transition to unknown
(cherry picked from commit d9c6b9f3dd)
This commit is contained in:
parent
859099f353
commit
7878e91b77
1 changed files with 10 additions and 6 deletions
|
|
@ -2539,13 +2539,17 @@ recheck_available (gpointer user_data)
|
|||
new_state = NM_DEVICE_STATE_UNAVAILABLE;
|
||||
nm_device_queue_state (self, new_state, priv->recheck_available.unavailable_reason);
|
||||
}
|
||||
_LOGD (LOGD_DEVICE, "device is %savailable, %s %s",
|
||||
now_available ? "" : "not ",
|
||||
new_state == NM_DEVICE_STATE_UNAVAILABLE ? "no change required for" : "will transition to",
|
||||
state_to_string (new_state == NM_DEVICE_STATE_UNAVAILABLE ? state : new_state));
|
||||
|
||||
priv->recheck_available.available_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
priv->recheck_available.unavailable_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
if (new_state > NM_DEVICE_STATE_UNKNOWN) {
|
||||
_LOGD (LOGD_DEVICE, "device is %savailable, %s %s",
|
||||
now_available ? "" : "not ",
|
||||
new_state == NM_DEVICE_STATE_UNAVAILABLE ? "no change required for" : "will transition to",
|
||||
state_to_string (new_state == NM_DEVICE_STATE_UNAVAILABLE ? state : new_state));
|
||||
|
||||
priv->recheck_available.available_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
priv->recheck_available.unavailable_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
}
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue