[glib] g_network_monitor_base_can_reach: Check for default route after enumerating.
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] g_network_monitor_base_can_reach: Check for default route after enumerating.
- Date: Wed, 20 Feb 2013 12:34:30 +0000 (UTC)
commit 4ca3d80ff3d5d076c0bfc187b4efa9fa51cbcca2
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Feb 19 11:18:11 2013 -0500
g_network_monitor_base_can_reach: Check for default route after enumerating.
Enumerate the GSocketConnectable before checking for a default route.
For some connectable types this will involve a DNS lookup. This will
elminate false positives for hosts behind a VPN since DNS lookup will
fail if the VPN is not connected.
https://bugzilla.gnome.org/show_bug.cgi?id=694181
gio/gnetworkmonitorbase.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gio/gnetworkmonitorbase.c b/gio/gnetworkmonitorbase.c
index 2494ca3..5baf5fd 100644
--- a/gio/gnetworkmonitorbase.c
+++ b/gio/gnetworkmonitorbase.c
@@ -168,10 +168,6 @@ g_network_monitor_base_can_reach (GNetworkMonitor *monitor,
GSocketAddressEnumerator *enumerator;
GSocketAddress *addr;
- if (priv->have_ipv4_default_route &&
- priv->have_ipv6_default_route)
- return TRUE;
-
if (priv->networks->len == 0)
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NETWORK_UNREACHABLE,
@@ -188,6 +184,14 @@ g_network_monitor_base_can_reach (GNetworkMonitor *monitor,
return FALSE;
}
+ if (priv->have_ipv4_default_route &&
+ priv->have_ipv6_default_route)
+ {
+ g_object_unref (enumerator);
+ g_object_unref (addr);
+ return TRUE;
+ }
+
while (addr)
{
if (G_IS_INET_SOCKET_ADDRESS (addr))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]