Skip to content

Commit

Permalink
switch to this.withlock
Browse files Browse the repository at this point in the history
  • Loading branch information
peckb1 committed Apr 24, 2024
1 parent 8c4a64e commit a4befc3
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import java.util.concurrent.TimeUnit.MILLISECONDS
import java.util.concurrent.locks.ReentrantLock
import javax.net.ssl.SSLPeerUnverifiedException
import javax.net.ssl.SSLSocket
import kotlin.concurrent.withLock
import kotlin.math.min
import okhttp3.Address
import okhttp3.Connection
Expand Down Expand Up @@ -339,7 +338,7 @@ class RealConnection(
return http2Connection.isHealthy(nowNs)
}

val idleDurationNs = lock.withLock { nowNs - idleAtNs }
val idleDurationNs = this.withLock { nowNs - idleAtNs }
if (idleDurationNs >= IDLE_CONNECTION_HEALTHY_NS && doExtensiveChecks) {
return socket.isHealthy(source)
}
Expand All @@ -358,7 +357,7 @@ class RealConnection(
connection: Http2Connection,
settings: Settings,
) {
lock.withLock {
this.withLock {
this.lastMaxConcurrentStreamsFromSettings = settings.getMaxConcurrentStreams()
recalculateAllocationLimit()
}
Expand All @@ -370,7 +369,7 @@ class RealConnection(
* made during settings changes
*/
internal fun recalculateAllocationLimit() {
lock.withLock {
this.withLock {
val oldLimit = allocationLimit
allocationLimit = getMaximumAllocationLimit()

Expand Down Expand Up @@ -426,7 +425,7 @@ class RealConnection(
e: IOException?,
) {
var noNewExchangesEvent = false
lock.withLock {
this.withLock {
if (e is StreamResetException) {
when {
e.errorCode == ErrorCode.REFUSED_STREAM -> {
Expand Down

0 comments on commit a4befc3

Please sign in to comment.