mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-19 15:58:29 +02:00
core: lie about NMActiveConnection:state in new connections
NMActiveConnections start out in state "unknown", but then quickly switch to "activating". Unfortunately, it's sometimes possible for this to be externally visible. Fix this by lying and saying that state is "activating" during the initial "unknown" stage (though not if the state changes to "unknown" later on). (Actually changing the initial state to "activating" breaks things because some code depends on there being a transition into the "activating" state.)
This commit is contained in:
parent
d78ea27d36
commit
4779d96685
1 changed files with 10 additions and 1 deletions
|
|
@ -51,6 +51,7 @@ typedef struct {
|
|||
gboolean is_default;
|
||||
gboolean is_default6;
|
||||
NMActiveConnectionState state;
|
||||
gboolean state_set;
|
||||
gboolean vpn;
|
||||
|
||||
NMAuthSubject *subject;
|
||||
|
|
@ -138,6 +139,7 @@ nm_active_connection_set_state (NMActiveConnection *self,
|
|||
|
||||
old_state = priv->state;
|
||||
priv->state = new_state;
|
||||
priv->state_set = TRUE;
|
||||
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE);
|
||||
|
||||
check_master_ready (self);
|
||||
|
|
@ -748,7 +750,14 @@ get_property (GObject *object, guint prop_id,
|
|||
g_value_take_boxed (value, devices);
|
||||
break;
|
||||
case PROP_STATE:
|
||||
g_value_set_uint (value, priv->state);
|
||||
if (priv->state_set)
|
||||
g_value_set_uint (value, priv->state);
|
||||
else {
|
||||
/* When the AC has just been created, its externally-visible state should
|
||||
* be "ACTIVATING", even though internally it is "UNKNOWN".
|
||||
*/
|
||||
g_value_set_uint (value, NM_ACTIVE_CONNECTION_STATE_ACTIVATING);
|
||||
}
|
||||
break;
|
||||
case PROP_DEFAULT:
|
||||
g_value_set_boolean (value, priv->is_default);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue