diff options
author | Dan Winship <danw@gnome.org> | 2013-07-31 09:14:39 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2013-08-28 10:54:08 -0400 |
commit | 8732914815ef315cd94ba67ba4b8247d90412b13 (patch) | |
tree | 4943806f14ba8aa3e67419122b19bb8f00106557 /src/nm-connectivity.h | |
parent | 52813b48c1c705ed06c588adda5f011123ac5f21 (diff) |
core: improve NMManager:state transitions with connectivity checking
The connectivity-checking code would generally result in
NMManager:state going CONNECTING -> CONNECTED_GLOBAL -> CONNECTED_SITE
in the case where the connectivity check failed. The brief incorrect
CONNECTED_GLOBAL is bad, because clients might see it and do the wrong
thing.
Instead, when we are ready to switch from CONNECTING to CONNECTED_*,
do a connectivity check first, and switch to either CONNECTED_SITE or
CONNECTED_GLOBAL based on the result of that.
Diffstat (limited to 'src/nm-connectivity.h')
-rw-r--r-- | src/nm-connectivity.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/nm-connectivity.h b/src/nm-connectivity.h index 0a7a39f7f5..36d6e8d12a 100644 --- a/src/nm-connectivity.h +++ b/src/nm-connectivity.h @@ -1,4 +1,3 @@ - /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* NetworkManager -- Network link manager * @@ -24,6 +23,7 @@ #include <glib.h> #include <glib-object.h> +#include <gio/gio.h> #include "NetworkManager.h" @@ -40,7 +40,6 @@ #define NM_CONNECTIVITY_RESPONSE "response" #define NM_CONNECTIVITY_CONNECTED "connected" - typedef struct { GObject parent; } NMConnectivity; @@ -51,13 +50,18 @@ typedef struct { GType nm_connectivity_get_type (void); - NMConnectivity *nm_connectivity_new (void); -void nm_connectivity_start_check (NMConnectivity *connectivity); +void nm_connectivity_set_online (NMConnectivity *self, + gboolean online); -void nm_connectivity_stop_check (NMConnectivity *connectivity); +gboolean nm_connectivity_get_connected (NMConnectivity *self); -gboolean nm_connectivity_get_connected (NMConnectivity *connectivity); +void nm_connectivity_check_async (NMConnectivity *self, + GAsyncReadyCallback callback, + gpointer user_data); +gboolean nm_connectivity_check_finish (NMConnectivity *self, + GAsyncResult *result, + GError **error); #endif /* NM_CONNECTIVITY_H */ |