зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1564310 - Allow fallback in strict mode for request timeouts r=necko-reviewers,kershaw
We don't actually want to fail requests that time out. So if the retry also times out we just fallback to native as usual. Depends on D137931 Differential Revision: https://phabricator.services.mozilla.com/D137932
This commit is contained in:
Родитель
5337335d54
Коммит
613521582a
|
@ -10218,6 +10218,12 @@
|
|||
value: false
|
||||
mirror: always
|
||||
|
||||
# If true, we'll fallback to native if the retry also times out.
|
||||
- name: network.trr.strict_native_fallback_allow_timeouts
|
||||
type: RelaxedAtomicBool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Single TRR request timeout (ms) when strict native fallback is enabled.
|
||||
- name: network.trr.strict_fallback_request_timeout_ms
|
||||
type: RelaxedAtomicUint32
|
||||
|
|
|
@ -1337,6 +1337,13 @@ bool nsHostResolver::MaybeRetryTRRLookup(
|
|||
}
|
||||
|
||||
if (aAddrRec->mTrrAttempts > 1) {
|
||||
if (aFirstAttemptSkipReason == TRRSkippedReason::TRR_TIMEOUT &&
|
||||
StaticPrefs::network_trr_strict_native_fallback_allow_timeouts()) {
|
||||
LOG(
|
||||
("nsHostResolver::MaybeRetryTRRLookup retry timed out. Using "
|
||||
"native."));
|
||||
return NS_SUCCEEDED(NativeLookup(aAddrRec, aLock));
|
||||
}
|
||||
LOG(("nsHostResolver::MaybeRetryTRRLookup mTrrAttempts>1, not retrying."));
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -249,6 +249,11 @@ async function test_strict_native_fallback() {
|
|||
10
|
||||
);
|
||||
|
||||
Services.prefs.setBoolPref(
|
||||
"network.trr.strict_native_fallback_allow_timeouts",
|
||||
false
|
||||
);
|
||||
|
||||
let { inStatus } = await new TRRDNSListener(
|
||||
"timeout.example.com",
|
||||
undefined,
|
||||
|
@ -258,6 +263,22 @@ async function test_strict_native_fallback() {
|
|||
!Components.isSuccessCode(inStatus),
|
||||
`${inStatus} should be an error code`
|
||||
);
|
||||
dns.clearCache(true);
|
||||
await new TRRDNSListener("timeout.example.com", undefined, false);
|
||||
|
||||
dns.clearCache(true);
|
||||
Services.prefs.setBoolPref(
|
||||
"network.trr.strict_native_fallback_allow_timeouts",
|
||||
true
|
||||
);
|
||||
await new TRRDNSListener("timeout.example.com", {
|
||||
expectedAnswer: "127.0.0.1",
|
||||
});
|
||||
|
||||
Services.prefs.setBoolPref(
|
||||
"network.trr.strict_native_fallback_allow_timeouts",
|
||||
false
|
||||
);
|
||||
|
||||
info("Now a connection error");
|
||||
dns.clearCache(true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче