mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 18:20:22 +01:00
connectivity: simplify redundant code
Merge the two nm_connectivity_set_online() calls into one, after tweaking NMConnectivity to always update its internal state before alerting callers to the new state.
This commit is contained in:
parent
5e182d5577
commit
0997c4b245
2 changed files with 5 additions and 5 deletions
|
|
@ -145,10 +145,10 @@ nm_connectivity_check_cb (SoupSession *session, SoupMessage *msg, gpointer user_
|
|||
}
|
||||
|
||||
done:
|
||||
update_state (self, new_state);
|
||||
|
||||
g_simple_async_result_set_op_res_gssize (simple, new_state);
|
||||
g_simple_async_result_complete (simple);
|
||||
|
||||
update_state (self, new_state);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -592,7 +592,6 @@ find_best_device_state (NMManager *manager)
|
|||
case NM_ACTIVE_CONNECTION_STATE_ACTIVATED:
|
||||
if ( nm_active_connection_get_default (ac)
|
||||
|| nm_active_connection_get_default6 (ac)) {
|
||||
nm_connectivity_set_online (priv->connectivity, TRUE);
|
||||
if (nm_connectivity_get_state (priv->connectivity) == NM_CONNECTIVITY_FULL)
|
||||
return NM_STATE_CONNECTED_GLOBAL;
|
||||
|
||||
|
|
@ -637,12 +636,13 @@ nm_manager_update_state (NMManager *manager)
|
|||
else
|
||||
new_state = find_best_device_state (manager);
|
||||
|
||||
nm_connectivity_set_online (priv->connectivity, new_state >= NM_STATE_CONNECTED_LOCAL);
|
||||
|
||||
if (new_state == NM_STATE_CONNECTED_SITE) {
|
||||
nm_connectivity_check_async (priv->connectivity,
|
||||
checked_connectivity,
|
||||
g_object_ref (manager));
|
||||
} else
|
||||
nm_connectivity_set_online (priv->connectivity, new_state >= NM_STATE_CONNECTED_LOCAL);
|
||||
}
|
||||
|
||||
set_state (manager, new_state);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue