mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
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
This commit is contained in:
parent
c6c1166566
commit
4ca3d80ff3
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user