bug 1470093 - fix telemetry::DNS_TRR_LOOKUP_TIME r?mcmanus
MozReview-Commit-ID: 80jrEQ4kLM6
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -1513,16 +1513,23 @@ nsHostResolver::CompleteLookup(nsHostRec
rec->mTrrAAAA = nullptr;
rec->mTrrAAAAUsed = NS_SUCCEEDED(status) ? nsHostRecord::OK : nsHostRecord::FAILED;
} else {
MOZ_ASSERT(0);
}
if (NS_SUCCEEDED(status)) {
rec->mTRRSuccess++;
+ if (rec->mTRRSuccess == 1) {
+ // Store the duration on first succesful TRR response. We
+ // don't know that there will be a second response nor can we
+ // tell which of two has useful data, especially in
+ // MODE_SHADOW where the actual results are discarded.
+ rec->mTrrDuration = TimeStamp::Now() - rec->mTrrStart;
+ }
}
if (TRROutstanding()) {
rec->mFirstTRRresult = status;
if (NS_FAILED(status)) {
return LOOKUP_OK; // wait for outstanding
}
// There's another TRR complete pending. Wait for it and keep
@@ -1581,21 +1588,16 @@ nsHostResolver::CompleteLookup(nsHostRec
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;