1
0
mirror of https://github.com/square/okhttp.git synced 2025-08-07 12:42:57 +03:00

Enable fastFallback by default (#7566)

This commit is contained in:
Yuri Schimke
2022-12-24 11:56:20 +10:00
committed by GitHub
parent 158c66bce2
commit d65406e9f9
2 changed files with 3 additions and 2 deletions

View File

@@ -115,7 +115,6 @@ class OkHttpClientTestRule : BeforeEachCallback, AfterEachCallback {
var client = testClient
if (client == null) {
client = OkHttpClient.Builder()
.fastFallback(true) // Test this by default, since it'll soon be the default.
.dns(SINGLE_INET_ADDRESS_DNS) // Prevent unexpected fallback addresses.
.eventListenerFactory { ClientRuleEventListener(logger = ::addEvent) }
.build()

View File

@@ -512,7 +512,7 @@ open class OkHttpClient internal constructor(
internal val networkInterceptors: MutableList<Interceptor> = mutableListOf()
internal var eventListenerFactory: EventListener.Factory = EventListener.NONE.asFactory()
internal var retryOnConnectionFailure = true
internal var fastFallback = false
internal var fastFallback = true
internal var authenticator: Authenticator = Authenticator.NONE
internal var followRedirects = true
internal var followSslRedirects = true
@@ -669,6 +669,8 @@ open class OkHttpClient internal constructor(
* This implements Happy Eyeballs ([RFC 6555][rfc_6555]), balancing connect latency vs.
* wasted resources.
*
* Defaults to enabled, call with [fastFallback] = false to revert to 4.x behaviour.
*
* [rfc_6555]: https://datatracker.ietf.org/doc/html/rfc6555
*/
fun fastFallback(fastFallback: Boolean) = apply {