bug 1445183 store TRR duration when the response is used r?valentin
Previously it would store the time even for early AAAA responses that
weren't used until the A response came in, thus getting the timing
wrong.
MozReview-Commit-ID: KctUjMjH5FR
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -1512,22 +1512,18 @@ nsHostResolver::CompleteLookup(nsHostRec
MOZ_ASSERT(rec->mTrrAAAA);
rec->mTrrAAAA = nullptr;
rec->mTrrAAAAUsed = NS_SUCCEEDED(status) ? nsHostRecord::OK : nsHostRecord::FAILED;
} else {
MOZ_ASSERT(0);
}
if (NS_SUCCEEDED(status)) {
- if (rec->mTRRSuccess == 0) { // first one
- rec->mTrrDuration = TimeStamp::Now() - rec->mTrrStart;
- }
rec->mTRRSuccess++;
}
-
if (TRROutstanding()) {
if (NS_FAILED(status)) {
return LOOKUP_OK; // wait for outstanding
}
// There's another TRR complete pending. Wait for it and keep
// this RRset around until then.
MOZ_ASSERT(!rec->mFirstTRR && newRRSet);
@@ -1571,16 +1567,22 @@ nsHostResolver::CompleteLookup(nsHostRec
if (!rec->mTRRSuccess && rec->mResolverMode == MODE_TRRFIRST) {
MOZ_ASSERT(!rec->mResolving);
NativeLookup(rec);
MOZ_ASSERT(rec->mResolving);
return LOOKUP_OK;
}
// continue
}
+
+ if (NS_SUCCEEDED(status) && (rec->mTRRSuccess == 1)) {
+ // store the duration on first (used) TRR response
+ rec->mTrrDuration = TimeStamp::Now() - rec->mTrrStart;
+ }
+
} else { // native resolve completed
if (rec->usingAnyThread) {
mActiveAnyThreadCount--;
rec->usingAnyThread = false;
}
rec->mNative = false;
rec->mNativeSuccess = newRRSet ? true : false;