diff options
author | Allison Karlitskaya <allison.karlitskaya@redhat.com> | 2019-05-23 09:33:00 +0200 |
---|---|---|
committer | Allison Karlitskaya <allison.karlitskaya@redhat.com> | 2019-06-04 23:01:37 +0200 |
commit | 2b6a3c110d7668f6c037ed6b713b90a74d032b92 (patch) | |
tree | 13c746fb39953354d93d60c7da0df161ad0c56ab | |
parent | 39cbb84e36d4d335d77f4f58fee68a047adf2141 (diff) | |
download | glib-2b6a3c110d7668f6c037ed6b713b90a74d032b92.tar.gz |
gnetworkaddress: fix "happy eyeballs" logic
The "happy eyeballs" RFC states that on receiving a negative response
for an IPv6 address lookup, we should wait for the IPv4 lookup to
complete and use any results we get from there.
The current code was not doing that: it was rather setting a timeout for
failing the resolution entirely. In scenarios where the IPv4 response
comes more than 50ms after the IPv6 response (which is easily attainable
under valgrind in certain configurations) this means that the IPv4
response will never come.
Remove the timeout and just wait.
See merge request GNOME/glib!865
-rw-r--r-- | gio/gnetworkaddress.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/gio/gnetworkaddress.c b/gio/gnetworkaddress.c index 72803903d..e46b5ac65 100644 --- a/gio/gnetworkaddress.c +++ b/gio/gnetworkaddress.c @@ -1261,13 +1261,8 @@ got_ipv6_addresses (GObject *source_object, */ if (error != NULL && !addr_enum->last_error && (addr_enum->state & RESOLVE_STATE_WAITING_ON_IPV4)) { + /* ipv6 lookup failed, but ipv4 is still outstanding. wait. */ addr_enum->last_error = g_steal_pointer (&error); - - addr_enum->wait_source = g_timeout_source_new (HAPPY_EYEBALLS_RESOLUTION_DELAY_MS); - g_source_set_callback (addr_enum->wait_source, - on_address_timeout, - addr_enum, NULL); - g_source_attach (addr_enum->wait_source, addr_enum->context); } else if (addr_enum->waiting_task != NULL) { |