Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable fastFallback by default #7566

Merged
merged 2 commits into from Dec 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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()
Expand Down
4 changes: 3 additions & 1 deletion okhttp/src/jvmMain/kotlin/okhttp3/OkHttpClient.kt
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down