summaryrefslogtreecommitdiffstats
path: root/net/base/net_util.h
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 17:51:12 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-19 17:51:12 +0000
commit70bd03d5a0e63545043b32286404b6aadf10ba75 (patch)
treef3f35cf5e0d221d06f3942ef59bdb0fc7ee8667f /net/base/net_util.h
parent36e0d1896ee038e157cde8df4164746caef16336 (diff)
downloadchromium_src-70bd03d5a0e63545043b32286404b6aadf10ba75.zip
chromium_src-70bd03d5a0e63545043b32286404b6aadf10ba75.tar.gz
chromium_src-70bd03d5a0e63545043b32286404b6aadf10ba75.tar.bz2
Merge 84251, 85083, 85188, 85375.
Add a fallback socket connect() for IPv6. When a hostname has both IPv6 and IPv4 addresses, and the IPv6 address is listed first, we start a timer (300ms) (deliberately chosen to be different from the backup connect job). If the timer fires, that means the IPv6 connect() hasn't completed yet, and we start a second socket connect() where we give it the same AddressList, except we move all IPv6 addresses that are in front of the first IPv4 address to the end. That way, we will use the first IPv4 address. We will race these two connect()s and pass the first one to complete to ConnectJob::set_socket(). Adds 4 new TCP connection latency histograms to assess the new behavior: IPv6 raceable (includes both when it races and doesn't, which are distinguished by whether or not the samples exceed the race timeout of 300ms) IPv6 solo (no IPv4 addresses to race against) IPv4 no race (IPv4 is the first address, so we're not racing) IPv4 wins race (IPv4 raced and won, even though it started behind). BUG=81686 TEST=On Linux, drop ip6 packets via `sudo ip6tables -A OUTPUT -p tcp -j DROP`. Then test against a site with both IPv6 and IPv4 addresses (such as www.ripe.net). It should load without hitting 20s connect() timeouts on the IPv6 addresses. Review URL: http://codereview.chromium.org/7029049 git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@85934 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/net_util.h')
-rw-r--r--net/base/net_util.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/base/net_util.h b/net/base/net_util.h
index 0ff3369..df99469 100644
--- a/net/base/net_util.h
+++ b/net/base/net_util.h
@@ -441,6 +441,16 @@ bool IPNumberMatchesPrefix(const IPAddressNumber& ip_number,
const IPAddressNumber& ip_prefix,
size_t prefix_length_in_bits);
+// Makes a copy of |info|. The dynamically-allocated parts are copied as well.
+// If |recursive| is true, chained entries via ai_next are copied too.
+// The copy returned by this function should be freed using
+// FreeCopyOfAddrinfo(), and NOT freeaddrinfo().
+struct addrinfo* CreateCopyOfAddrinfo(const struct addrinfo* info,
+ bool recursive);
+
+// Frees an addrinfo that was created by CreateCopyOfAddrinfo().
+void FreeCopyOfAddrinfo(struct addrinfo* info);
+
// Returns the port field of the sockaddr in |info|.
const uint16* GetPortFieldFromAddrinfo(const struct addrinfo* info);
uint16* GetPortFieldFromAddrinfo(struct addrinfo* info);