Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: net/dns/host_resolver_impl.cc

Issue 2562073003: De-flake HostResolverImplTest.IsIPv6Reachable. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/host_resolver_impl.cc
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
index e4ee073591d764edfd0f20e786493da4eef2b7dd..60fd4742b8e572742a4c176f5fd423a23caa9c18 100644
--- a/net/dns/host_resolver_impl.cc
+++ b/net/dns/host_resolver_impl.cc
@@ -2336,12 +2336,14 @@ HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest(
}
bool HostResolverImpl::IsIPv6Reachable(const NetLogWithSource& net_log) {
- base::TimeTicks now = base::TimeTicks::Now();
+ // Cache the result for kIPv6ProbePeriodMs (measured from after
+ // IsGloballyReachable() completes).
bool cached = true;
- if ((now - last_ipv6_probe_time_).InMilliseconds() > kIPv6ProbePeriodMs) {
+ if ((base::TimeTicks::Now() - last_ipv6_probe_time_).InMilliseconds() >
+ kIPv6ProbePeriodMs) {
last_ipv6_probe_result_ =
IsGloballyReachable(IPAddress(kIPv6ProbeAddress), net_log);
- last_ipv6_probe_time_ = now;
+ last_ipv6_probe_time_ = base::TimeTicks::Now();
cached = false;
}
net_log.AddEvent(NetLogEventType::HOST_RESOLVER_IMPL_IPV6_REACHABILITY_CHECK,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698