GNetworkAddress: drop cached addresses on resolver reload

If the resolver reloads (ie, if /etc/resolv.conf changes),
GNetworkAddress needs to re-resolve its addresses the next time it's
enumerated. Otherwise hosts that have different IP addresses inside
and outside a VPN won't work correctly if you hold on to a
GNetworkAddress for them for a long time.

https://bugzilla.gnome.org/show_bug.cgi?id=694181
This commit is contained in:
Dan Winship
2013-02-19 15:19:22 -05:00
parent cfafad5aef
commit c6c1166566
3 changed files with 67 additions and 19 deletions

View File

@@ -846,6 +846,20 @@ g_resolver_lookup_records_finish (GResolver *resolver,
lookup_records_finish (resolver, result, error);
}
guint64
g_resolver_get_serial (GResolver *resolver)
{
g_return_val_if_fail (G_IS_RESOLVER (resolver), 0);
g_resolver_maybe_reload (resolver);
#ifdef G_OS_UNIX
return (guint64) resolver->priv->resolv_conf_timestamp;
#else
return 1;
#endif
}
/**
* g_resolver_error_quark:
*