diff options
author | Dan Winship <danw@redhat.com> | 2015-01-13 15:35:10 -0500 |
---|---|---|
committer | Dan Winship <danw@redhat.com> | 2015-01-15 10:22:13 -0500 |
commit | 0997c4b245ca5638d0d27eee90146dc47c56130d (patch) | |
tree | 130217b8dd120c0fcfe44a90852d795a37adfba6 | |
parent | 5e182d55777b95886d39068821d1d6fa8298474d (diff) | |
download | NetworkManager-0997c4b245ca5638d0d27eee90146dc47c56130d.tar.gz |
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.
-rw-r--r-- | src/nm-connectivity.c | 4 | ||||
-rw-r--r-- | src/nm-manager.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c index 5913fd96c0..cf4552a8d7 100644 --- a/src/nm-connectivity.c +++ b/src/nm-connectivity.c @@ -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 diff --git a/src/nm-manager.c b/src/nm-manager.c index 0ba607fb85..53546d2752 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -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); } |