From c6a955fc8c0cbcdce3759fe0fc438b65026b75f9 Mon Sep 17 00:00:00 2001 From: Brian Peck Date: Wed, 24 Apr 2024 14:43:33 -0700 Subject: [PATCH] Swap order of new member in AddressPolicy --- okhttp/api/okhttp.api | 4 ++-- okhttp/src/main/kotlin/okhttp3/ConnectionPool.kt | 9 ++++----- .../kotlin/okhttp3/internal/connection/RealConnection.kt | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/okhttp/api/okhttp.api b/okhttp/api/okhttp.api index 3c52e9299177..477455be4125 100644 --- a/okhttp/api/okhttp.api +++ b/okhttp/api/okhttp.api @@ -393,8 +393,8 @@ public final class okhttp3/ConnectionPool$AddressPolicy { public final field maximumConcurrentCallsPerConnection I public final field minimumConcurrentCalls I public fun ()V - public fun (IIJI)V - public synthetic fun (IIJIILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (IJII)V + public synthetic fun (IJIIILkotlin/jvm/internal/DefaultConstructorMarker;)V } public final class okhttp3/ConnectionSpec { diff --git a/okhttp/src/main/kotlin/okhttp3/ConnectionPool.kt b/okhttp/src/main/kotlin/okhttp3/ConnectionPool.kt index 1a6f754adaa4..53aac058a6a9 100644 --- a/okhttp/src/main/kotlin/okhttp3/ConnectionPool.kt +++ b/okhttp/src/main/kotlin/okhttp3/ConnectionPool.kt @@ -148,15 +148,14 @@ class ConnectionPool internal constructor( * Connections will still be closed if they idle beyond the keep-alive but will be replaced. */ @JvmField val minimumConcurrentCalls: Int = 0, + /** How long to wait to retry pre-emptive connection attempts that fail. */ + @JvmField val backoffDelayMillis: Long = 60 * 1000, + /** How much jitter to introduce in connection retry backoff delays */ + @JvmField val backoffJitterMillis: Int = 100, /** * The maximum number of concurrent calls per connection. - * * Set this value to 1 to disable HTTP/2 connection coalescing */ @JvmField val maximumConcurrentCallsPerConnection: Int = Int.MAX_VALUE, - /** How long to wait to retry pre-emptive connection attempts that fail. */ - @JvmField val backoffDelayMillis: Long = 60 * 1000, - /** How much jitter to introduce in connection retry backoff delays */ - @JvmField val backoffJitterMillis: Int = 100, ) } diff --git a/okhttp/src/main/kotlin/okhttp3/internal/connection/RealConnection.kt b/okhttp/src/main/kotlin/okhttp3/internal/connection/RealConnection.kt index 40ffc2b0a561..f4b456d68840 100644 --- a/okhttp/src/main/kotlin/okhttp3/internal/connection/RealConnection.kt +++ b/okhttp/src/main/kotlin/okhttp3/internal/connection/RealConnection.kt @@ -357,7 +357,7 @@ class RealConnection( connection: Http2Connection, settings: Settings, ) { - this.withLock { + this.withLock { this.lastMaxConcurrentStreamsFromSettings = settings.getMaxConcurrentStreams() recalculateAllocationLimit() } @@ -369,7 +369,7 @@ class RealConnection( * made during settings changes */ internal fun recalculateAllocationLimit() { - this.withLock { + this.withLock { val oldLimit = allocationLimit allocationLimit = getMaximumAllocationLimit() @@ -425,7 +425,7 @@ class RealConnection( e: IOException?, ) { var noNewExchangesEvent = false - this.withLock { + this.withLock { if (e is StreamResetException) { when { e.errorCode == ErrorCode.REFUSED_STREAM -> {