Rabbit-R1/switch port/smali/smali_classes3/okhttp3/internal/connection/RealConnectionPool.smali
2024-05-21 17:08:36 -04:00

1201 lines
32 KiB
Smali

.class public final Lokhttp3/internal/connection/RealConnectionPool;
.super Ljava/lang/Object;
.source "RealConnectionPool.kt"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lokhttp3/internal/connection/RealConnectionPool$Companion;
}
.end annotation
.annotation system Ldalvik/annotation/SourceDebugExtension;
value = "SMAP\nRealConnectionPool.kt\nKotlin\n*S Kotlin\n*F\n+ 1 RealConnectionPool.kt\nokhttp3/internal/connection/RealConnectionPool\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 4 Util.kt\nokhttp3/internal/Util\n*L\n1#1,250:1\n1718#2,3:251\n1721#2:255\n1#3:254\n601#4,4:256\n601#4,4:260\n601#4,4:264\n*E\n*S KotlinDebug\n*F\n+ 1 RealConnectionPool.kt\nokhttp3/internal/connection/RealConnectionPool\n*L\n60#1,3:251\n60#1:255\n95#1,4:256\n106#1,4:260\n215#1,4:264\n*E\n"
.end annotation
.annotation runtime Lkotlin/Metadata;
bv = {
0x1,
0x0,
0x3
}
d1 = {
"\u0000c\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0008\n\u0000\n\u0002\u0010\t\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0008\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0008\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\u0008\u0007\n\u0002\u0010\u0002\n\u0002\u0008\u0005*\u0001\u000e\u0018\u0000 (2\u00020\u0001:\u0001(B%\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\u0008\u001a\u00020\t\u00a2\u0006\u0002\u0010\nJ.\u0010\u0014\u001a\u00020\u00152\u0006\u0010\u0016\u001a\u00020\u00172\u0006\u0010\u0018\u001a\u00020\u00192\u000e\u0010\u001a\u001a\n\u0012\u0004\u0012\u00020\u001c\u0018\u00010\u001b2\u0006\u0010\u001d\u001a\u00020\u0015J\u000e\u0010\u001e\u001a\u00020\u00072\u0006\u0010\u001f\u001a\u00020\u0007J\u000e\u0010 \u001a\u00020\u00152\u0006\u0010!\u001a\u00020\u0012J\u0006\u0010\"\u001a\u00020\u0005J\u0006\u0010#\u001a\u00020$J\u0006\u0010%\u001a\u00020\u0005J\u0018\u0010&\u001a\u00020\u00052\u0006\u0010!\u001a\u00020\u00122\u0006\u0010\u001f\u001a\u00020\u0007H\u0002J\u000e\u0010\'\u001a\u00020$2\u0006\u0010!\u001a\u00020\u0012R\u000e\u0010\u000b\u001a\u00020\u000cX\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u0010\u0010\r\u001a\u00020\u000eX\u0082\u0004\u00a2\u0006\u0004\n\u0002\u0010\u000fR\u0014\u0010\u0010\u001a\u0008\u0012\u0004\u0012\u00020\u00120\u0011X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0013\u001a\u00020\u0007X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0004\u001a\u00020\u0005X\u0082\u0004\u00a2\u0006\u0002\n\u0000\u00a8\u0006)"
}
d2 = {
"Lokhttp3/internal/connection/RealConnectionPool;",
"",
"taskRunner",
"Lokhttp3/internal/concurrent/TaskRunner;",
"maxIdleConnections",
"",
"keepAliveDuration",
"",
"timeUnit",
"Ljava/util/concurrent/TimeUnit;",
"(Lokhttp3/internal/concurrent/TaskRunner;IJLjava/util/concurrent/TimeUnit;)V",
"cleanupQueue",
"Lokhttp3/internal/concurrent/TaskQueue;",
"cleanupTask",
"okhttp3/internal/connection/RealConnectionPool$cleanupTask$1",
"Lokhttp3/internal/connection/RealConnectionPool$cleanupTask$1;",
"connections",
"Ljava/util/concurrent/ConcurrentLinkedQueue;",
"Lokhttp3/internal/connection/RealConnection;",
"keepAliveDurationNs",
"callAcquirePooledConnection",
"",
"address",
"Lokhttp3/Address;",
"call",
"Lokhttp3/internal/connection/RealCall;",
"routes",
"",
"Lokhttp3/Route;",
"requireMultiplexed",
"cleanup",
"now",
"connectionBecameIdle",
"connection",
"connectionCount",
"evictAll",
"",
"idleConnectionCount",
"pruneAndGetAllocationCount",
"put",
"Companion",
"okhttp"
}
k = 0x1
mv = {
0x1,
0x4,
0x0
}
.end annotation
# static fields
.field public static final Companion:Lokhttp3/internal/connection/RealConnectionPool$Companion;
# instance fields
.field private final cleanupQueue:Lokhttp3/internal/concurrent/TaskQueue;
.field private final cleanupTask:Lokhttp3/internal/connection/RealConnectionPool$cleanupTask$1;
.field private final connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
.annotation system Ldalvik/annotation/Signature;
value = {
"Ljava/util/concurrent/ConcurrentLinkedQueue<",
"Lokhttp3/internal/connection/RealConnection;",
">;"
}
.end annotation
.end field
.field private final keepAliveDurationNs:J
.field private final maxIdleConnections:I
# direct methods
.method static constructor <clinit>()V
.locals 2
new-instance v0, Lokhttp3/internal/connection/RealConnectionPool$Companion;
const/4 v1, 0x0
invoke-direct {v0, v1}, Lokhttp3/internal/connection/RealConnectionPool$Companion;-><init>(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
sput-object v0, Lokhttp3/internal/connection/RealConnectionPool;->Companion:Lokhttp3/internal/connection/RealConnectionPool$Companion;
return-void
.end method
.method public constructor <init>(Lokhttp3/internal/concurrent/TaskRunner;IJLjava/util/concurrent/TimeUnit;)V
.locals 2
const-string v0, "taskRunner"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
const-string v0, "timeUnit"
invoke-static {p5, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 33
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput p2, p0, Lokhttp3/internal/connection/RealConnectionPool;->maxIdleConnections:I
.line 40
invoke-virtual {p5, p3, p4}, Ljava/util/concurrent/TimeUnit;->toNanos(J)J
move-result-wide v0
iput-wide v0, p0, Lokhttp3/internal/connection/RealConnectionPool;->keepAliveDurationNs:J
.line 42
invoke-virtual {p1}, Lokhttp3/internal/concurrent/TaskRunner;->newQueue()Lokhttp3/internal/concurrent/TaskQueue;
move-result-object p1
iput-object p1, p0, Lokhttp3/internal/connection/RealConnectionPool;->cleanupQueue:Lokhttp3/internal/concurrent/TaskQueue;
.line 43
new-instance p1, Lokhttp3/internal/connection/RealConnectionPool$cleanupTask$1;
new-instance p2, Ljava/lang/StringBuilder;
invoke-direct {p2}, Ljava/lang/StringBuilder;-><init>()V
sget-object p5, Lokhttp3/internal/Util;->okHttpName:Ljava/lang/String;
invoke-virtual {p2, p5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p2
const-string p5, " ConnectionPool"
invoke-virtual {p2, p5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p2
invoke-virtual {p2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p2
invoke-direct {p1, p0, p2}, Lokhttp3/internal/connection/RealConnectionPool$cleanupTask$1;-><init>(Lokhttp3/internal/connection/RealConnectionPool;Ljava/lang/String;)V
iput-object p1, p0, Lokhttp3/internal/connection/RealConnectionPool;->cleanupTask:Lokhttp3/internal/connection/RealConnectionPool$cleanupTask$1;
.line 52
new-instance p1, Ljava/util/concurrent/ConcurrentLinkedQueue;
invoke-direct {p1}, Ljava/util/concurrent/ConcurrentLinkedQueue;-><init>()V
iput-object p1, p0, Lokhttp3/internal/connection/RealConnectionPool;->connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
const-wide/16 p0, 0x0
cmp-long p0, p3, p0
if-lez p0, :cond_0
const/4 p0, 0x1
goto :goto_0
:cond_0
const/4 p0, 0x0
:goto_0
if-eqz p0, :cond_1
return-void
.line 56
:cond_1
new-instance p0, Ljava/lang/StringBuilder;
const-string p1, "keepAliveDuration <= 0: "
invoke-direct {p0, p1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p0, p3, p4}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
new-instance p1, Ljava/lang/IllegalArgumentException;
invoke-virtual {p0}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object p0
invoke-direct {p1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
check-cast p1, Ljava/lang/Throwable;
throw p1
.end method
.method private final pruneAndGetAllocationCount(Lokhttp3/internal/connection/RealConnection;J)I
.locals 6
.line 264
sget-boolean v0, Lokhttp3/internal/Util;->assertionsEnabled:Z
if-eqz v0, :cond_1
invoke-static {p1}, Ljava/lang/Thread;->holdsLock(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
goto :goto_0
.line 265
:cond_0
new-instance p0, Ljava/lang/AssertionError;
new-instance p2, Ljava/lang/StringBuilder;
const-string p3, "Thread "
invoke-direct {p2, p3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
move-result-object p3
const-string v0, "Thread.currentThread()"
invoke-static {p3, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-virtual {p3}, Ljava/lang/Thread;->getName()Ljava/lang/String;
move-result-object p3
invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p2
const-string p3, " MUST hold lock on "
invoke-virtual {p2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p2
invoke-virtual {p2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p0, p1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
.line 217
:cond_1
:goto_0
invoke-virtual {p1}, Lokhttp3/internal/connection/RealConnection;->getCalls()Ljava/util/List;
move-result-object v0
const/4 v1, 0x0
move v2, v1
.line 219
:cond_2
:goto_1
invoke-interface {v0}, Ljava/util/List;->size()I
move-result v3
if-ge v2, v3, :cond_5
.line 220
invoke-interface {v0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v3
check-cast v3, Ljava/lang/ref/Reference;
.line 222
invoke-virtual {v3}, Ljava/lang/ref/Reference;->get()Ljava/lang/Object;
move-result-object v4
if-eqz v4, :cond_3
add-int/lit8 v2, v2, 0x1
goto :goto_1
:cond_3
if-eqz v3, :cond_4
.line 228
check-cast v3, Lokhttp3/internal/connection/RealCall$CallReference;
.line 229
new-instance v4, Ljava/lang/StringBuilder;
const-string v5, "A connection to "
invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {p1}, Lokhttp3/internal/connection/RealConnection;->route()Lokhttp3/Route;
move-result-object v5
invoke-virtual {v5}, Lokhttp3/Route;->address()Lokhttp3/Address;
move-result-object v5
invoke-virtual {v5}, Lokhttp3/Address;->url()Lokhttp3/HttpUrl;
move-result-object v5
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v4
const-string v5, " was leaked. Did you forget to close a response body?"
invoke-virtual {v4, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v4
invoke-virtual {v4}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v4
.line 231
sget-object v5, Lokhttp3/internal/platform/Platform;->Companion:Lokhttp3/internal/platform/Platform$Companion;
invoke-virtual {v5}, Lokhttp3/internal/platform/Platform$Companion;->get()Lokhttp3/internal/platform/Platform;
move-result-object v5
invoke-virtual {v3}, Lokhttp3/internal/connection/RealCall$CallReference;->getCallStackTrace()Ljava/lang/Object;
move-result-object v3
invoke-virtual {v5, v4, v3}, Lokhttp3/internal/platform/Platform;->logCloseableLeak(Ljava/lang/String;Ljava/lang/Object;)V
.line 233
invoke-interface {v0, v2}, Ljava/util/List;->remove(I)Ljava/lang/Object;
const/4 v3, 0x1
.line 234
invoke-virtual {p1, v3}, Lokhttp3/internal/connection/RealConnection;->setNoNewExchanges(Z)V
.line 237
invoke-interface {v0}, Ljava/util/List;->isEmpty()Z
move-result v3
if-eqz v3, :cond_2
iget-wide v2, p0, Lokhttp3/internal/connection/RealConnectionPool;->keepAliveDurationNs:J
sub-long/2addr p2, v2
.line 238
invoke-virtual {p1, p2, p3}, Lokhttp3/internal/connection/RealConnection;->setIdleAtNs$okhttp(J)V
return v1
.line 228
:cond_4
new-instance p0, Ljava/lang/NullPointerException;
const-string p1, "null cannot be cast to non-null type okhttp3.internal.connection.RealCall.CallReference"
invoke-direct {p0, p1}, Ljava/lang/NullPointerException;-><init>(Ljava/lang/String;)V
throw p0
.line 243
:cond_5
invoke-interface {v0}, Ljava/util/List;->size()I
move-result p0
return p0
.end method
# virtual methods
.method public final callAcquirePooledConnection(Lokhttp3/Address;Lokhttp3/internal/connection/RealCall;Ljava/util/List;Z)Z
.locals 2
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lokhttp3/Address;",
"Lokhttp3/internal/connection/RealCall;",
"Ljava/util/List<",
"Lokhttp3/Route;",
">;Z)Z"
}
.end annotation
const-string v0, "address"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
const-string v0, "call"
invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
iget-object p0, p0, Lokhttp3/internal/connection/RealConnectionPool;->connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
.line 83
invoke-virtual {p0}, Ljava/util/concurrent/ConcurrentLinkedQueue;->iterator()Ljava/util/Iterator;
move-result-object p0
:goto_0
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_2
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lokhttp3/internal/connection/RealConnection;
const-string v1, "connection"
.line 84
invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
monitor-enter v0
if-eqz p4, :cond_0
.line 85
:try_start_0
invoke-virtual {v0}, Lokhttp3/internal/connection/RealConnection;->isMultiplexed$okhttp()Z
move-result v1
if-nez v1, :cond_0
goto :goto_1
.line 86
:cond_0
invoke-virtual {v0, p1, p3}, Lokhttp3/internal/connection/RealConnection;->isEligible$okhttp(Lokhttp3/Address;Ljava/util/List;)Z
move-result v1
if-nez v1, :cond_1
.line 88
:goto_1
sget-object v1, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 84
monitor-exit v0
goto :goto_0
.line 87
:cond_1
:try_start_1
invoke-virtual {p2, v0}, Lokhttp3/internal/connection/RealCall;->acquireConnectionNoEvents(Lokhttp3/internal/connection/RealConnection;)V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
.line 88
monitor-exit v0
const/4 p0, 0x1
return p0
:catchall_0
move-exception p0
.line 84
monitor-exit v0
throw p0
:cond_2
const/4 p0, 0x0
return p0
.end method
.method public final cleanup(J)J
.locals 10
const/4 v0, 0x0
.line 148
move-object v1, v0
check-cast v1, Lokhttp3/internal/connection/RealConnection;
iget-object v1, p0, Lokhttp3/internal/connection/RealConnectionPool;->connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
.line 152
invoke-virtual {v1}, Ljava/util/concurrent/ConcurrentLinkedQueue;->iterator()Ljava/util/Iterator;
move-result-object v1
const/4 v2, 0x0
const-wide/high16 v3, -0x8000000000000000L
move-wide v4, v3
move v3, v2
:goto_0
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
move-result v6
if-eqz v6, :cond_2
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v6
check-cast v6, Lokhttp3/internal/connection/RealConnection;
const-string v7, "connection"
.line 153
invoke-static {v6, v7}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
monitor-enter v6
.line 155
:try_start_0
invoke-direct {p0, v6, p1, p2}, Lokhttp3/internal/connection/RealConnectionPool;->pruneAndGetAllocationCount(Lokhttp3/internal/connection/RealConnection;J)I
move-result v7
if-lez v7, :cond_0
add-int/lit8 v7, v3, 0x1
.line 156
invoke-static {v3}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
move v3, v7
goto :goto_1
:cond_0
add-int/lit8 v2, v2, 0x1
.line 161
invoke-virtual {v6}, Lokhttp3/internal/connection/RealConnection;->getIdleAtNs$okhttp()J
move-result-wide v7
sub-long v7, p1, v7
cmp-long v9, v7, v4
if-lez v9, :cond_1
.line 164
sget-object v0, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit;
move-object v0, v6
move-wide v4, v7
goto :goto_1
.line 166
:cond_1
sget-object v7, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 153
:goto_1
monitor-exit v6
goto :goto_0
:catchall_0
move-exception p0
monitor-exit v6
throw p0
:cond_2
iget-wide v6, p0, Lokhttp3/internal/connection/RealConnectionPool;->keepAliveDurationNs:J
cmp-long v1, v4, v6
if-gez v1, :cond_6
iget v1, p0, Lokhttp3/internal/connection/RealConnectionPool;->maxIdleConnections:I
if-le v2, v1, :cond_3
goto :goto_2
:cond_3
if-lez v2, :cond_4
sub-long/2addr v6, v4
return-wide v6
:cond_4
if-lez v3, :cond_5
return-wide v6
:cond_5
const-wide/16 p0, -0x1
return-wide p0
.line 176
:cond_6
:goto_2
invoke-static {v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V
.line 177
monitor-enter v0
.line 178
:try_start_1
invoke-virtual {v0}, Lokhttp3/internal/connection/RealConnection;->getCalls()Ljava/util/List;
move-result-object v1
check-cast v1, Ljava/util/Collection;
invoke-interface {v1}, Ljava/util/Collection;->isEmpty()Z
move-result v1
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_1
const/4 v2, 0x1
xor-int/2addr v1, v2
const-wide/16 v6, 0x0
if-eqz v1, :cond_7
monitor-exit v0
return-wide v6
.line 179
:cond_7
:try_start_2
invoke-virtual {v0}, Lokhttp3/internal/connection/RealConnection;->getIdleAtNs$okhttp()J
move-result-wide v8
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_1
add-long/2addr v8, v4
cmp-long p1, v8, p1
if-eqz p1, :cond_8
monitor-exit v0
return-wide v6
.line 180
:cond_8
:try_start_3
invoke-virtual {v0, v2}, Lokhttp3/internal/connection/RealConnection;->setNoNewExchanges(Z)V
iget-object p1, p0, Lokhttp3/internal/connection/RealConnectionPool;->connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
.line 181
invoke-virtual {p1, v0}, Ljava/util/concurrent/ConcurrentLinkedQueue;->remove(Ljava/lang/Object;)Z
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_1
.line 177
monitor-exit v0
.line 184
invoke-virtual {v0}, Lokhttp3/internal/connection/RealConnection;->socket()Ljava/net/Socket;
move-result-object p1
invoke-static {p1}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
iget-object p1, p0, Lokhttp3/internal/connection/RealConnectionPool;->connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
.line 185
invoke-virtual {p1}, Ljava/util/concurrent/ConcurrentLinkedQueue;->isEmpty()Z
move-result p1
if-eqz p1, :cond_9
iget-object p0, p0, Lokhttp3/internal/connection/RealConnectionPool;->cleanupQueue:Lokhttp3/internal/concurrent/TaskQueue;
invoke-virtual {p0}, Lokhttp3/internal/concurrent/TaskQueue;->cancelAll()V
:cond_9
return-wide v6
:catchall_1
move-exception p0
.line 177
monitor-exit v0
throw p0
.end method
.method public final connectionBecameIdle(Lokhttp3/internal/connection/RealConnection;)Z
.locals 7
const-string v0, "connection"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 260
sget-boolean v0, Lokhttp3/internal/Util;->assertionsEnabled:Z
if-eqz v0, :cond_1
invoke-static {p1}, Ljava/lang/Thread;->holdsLock(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
goto :goto_0
.line 261
:cond_0
new-instance p0, Ljava/lang/AssertionError;
new-instance v0, Ljava/lang/StringBuilder;
const-string v1, "Thread "
invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
move-result-object v1
const-string v2, "Thread.currentThread()"
invoke-static {v1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-virtual {v1}, Ljava/lang/Thread;->getName()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v1, " MUST hold lock on "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p0, p1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
.line 108
:cond_1
:goto_0
invoke-virtual {p1}, Lokhttp3/internal/connection/RealConnection;->getNoNewExchanges()Z
move-result v0
if-nez v0, :cond_3
iget v0, p0, Lokhttp3/internal/connection/RealConnectionPool;->maxIdleConnections:I
if-nez v0, :cond_2
goto :goto_1
:cond_2
iget-object v1, p0, Lokhttp3/internal/connection/RealConnectionPool;->cleanupQueue:Lokhttp3/internal/concurrent/TaskQueue;
iget-object p0, p0, Lokhttp3/internal/connection/RealConnectionPool;->cleanupTask:Lokhttp3/internal/connection/RealConnectionPool$cleanupTask$1;
.line 114
move-object v2, p0
check-cast v2, Lokhttp3/internal/concurrent/Task;
const-wide/16 v3, 0x0
const/4 v5, 0x2
const/4 v6, 0x0
invoke-static/range {v1 .. v6}, Lokhttp3/internal/concurrent/TaskQueue;->schedule$default(Lokhttp3/internal/concurrent/TaskQueue;Lokhttp3/internal/concurrent/Task;JILjava/lang/Object;)V
const/4 p0, 0x0
goto :goto_2
:cond_3
:goto_1
const/4 v0, 0x1
.line 109
invoke-virtual {p1, v0}, Lokhttp3/internal/connection/RealConnection;->setNoNewExchanges(Z)V
iget-object v1, p0, Lokhttp3/internal/connection/RealConnectionPool;->connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
.line 110
invoke-virtual {v1, p1}, Ljava/util/concurrent/ConcurrentLinkedQueue;->remove(Ljava/lang/Object;)Z
iget-object p1, p0, Lokhttp3/internal/connection/RealConnectionPool;->connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
.line 111
invoke-virtual {p1}, Ljava/util/concurrent/ConcurrentLinkedQueue;->isEmpty()Z
move-result p1
if-eqz p1, :cond_4
iget-object p0, p0, Lokhttp3/internal/connection/RealConnectionPool;->cleanupQueue:Lokhttp3/internal/concurrent/TaskQueue;
invoke-virtual {p0}, Lokhttp3/internal/concurrent/TaskQueue;->cancelAll()V
:cond_4
move p0, v0
:goto_2
return p0
.end method
.method public final connectionCount()I
.locals 0
iget-object p0, p0, Lokhttp3/internal/connection/RealConnectionPool;->connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
.line 66
invoke-virtual {p0}, Ljava/util/concurrent/ConcurrentLinkedQueue;->size()I
move-result p0
return p0
.end method
.method public final evictAll()V
.locals 3
iget-object v0, p0, Lokhttp3/internal/connection/RealConnectionPool;->connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
.line 120
invoke-virtual {v0}, Ljava/util/concurrent/ConcurrentLinkedQueue;->iterator()Ljava/util/Iterator;
move-result-object v0
const-string v1, "connections.iterator()"
invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
.line 121
:cond_0
:goto_0
invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z
move-result v1
if-eqz v1, :cond_2
.line 122
invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v1
check-cast v1, Lokhttp3/internal/connection/RealConnection;
const-string v2, "connection"
.line 123
invoke-static {v1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
monitor-enter v1
.line 124
:try_start_0
invoke-virtual {v1}, Lokhttp3/internal/connection/RealConnection;->getCalls()Ljava/util/List;
move-result-object v2
invoke-interface {v2}, Ljava/util/List;->isEmpty()Z
move-result v2
if-eqz v2, :cond_1
.line 125
invoke-interface {v0}, Ljava/util/Iterator;->remove()V
const/4 v2, 0x1
.line 126
invoke-virtual {v1, v2}, Lokhttp3/internal/connection/RealConnection;->setNoNewExchanges(Z)V
.line 127
invoke-virtual {v1}, Lokhttp3/internal/connection/RealConnection;->socket()Ljava/net/Socket;
move-result-object v2
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_1
:cond_1
const/4 v2, 0x0
.line 123
:goto_1
monitor-exit v1
if-eqz v2, :cond_0
.line 132
invoke-static {v2}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
goto :goto_0
:catchall_0
move-exception p0
.line 123
monitor-exit v1
throw p0
:cond_2
iget-object v0, p0, Lokhttp3/internal/connection/RealConnectionPool;->connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
.line 135
invoke-virtual {v0}, Ljava/util/concurrent/ConcurrentLinkedQueue;->isEmpty()Z
move-result v0
if-eqz v0, :cond_3
iget-object p0, p0, Lokhttp3/internal/connection/RealConnectionPool;->cleanupQueue:Lokhttp3/internal/concurrent/TaskQueue;
invoke-virtual {p0}, Lokhttp3/internal/concurrent/TaskQueue;->cancelAll()V
:cond_3
return-void
.end method
.method public final idleConnectionCount()I
.locals 3
iget-object p0, p0, Lokhttp3/internal/connection/RealConnectionPool;->connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
.line 60
check-cast p0, Ljava/lang/Iterable;
.line 251
instance-of v0, p0, Ljava/util/Collection;
const/4 v1, 0x0
if-eqz v0, :cond_0
move-object v0, p0
check-cast v0, Ljava/util/Collection;
invoke-interface {v0}, Ljava/util/Collection;->isEmpty()Z
move-result v0
if-eqz v0, :cond_0
goto :goto_1
.line 253
:cond_0
invoke-interface {p0}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;
move-result-object p0
:cond_1
:goto_0
invoke-interface {p0}, Ljava/util/Iterator;->hasNext()Z
move-result v0
if-eqz v0, :cond_2
invoke-interface {p0}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Lokhttp3/internal/connection/RealConnection;
const-string v2, "it"
.line 61
invoke-static {v0, v2}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
monitor-enter v0
:try_start_0
invoke-virtual {v0}, Lokhttp3/internal/connection/RealConnection;->getCalls()Ljava/util/List;
move-result-object v2
invoke-interface {v2}, Ljava/util/List;->isEmpty()Z
move-result v2
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit v0
if-eqz v2, :cond_1
add-int/lit8 v1, v1, 0x1
if-gez v1, :cond_1
invoke-static {}, Lkotlin/collections/CollectionsKt;->throwCountOverflow()V
goto :goto_0
:catchall_0
move-exception p0
monitor-exit v0
throw p0
:cond_2
:goto_1
return v1
.end method
.method public final put(Lokhttp3/internal/connection/RealConnection;)V
.locals 7
const-string v0, "connection"
invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 256
sget-boolean v0, Lokhttp3/internal/Util;->assertionsEnabled:Z
if-eqz v0, :cond_1
invoke-static {p1}, Ljava/lang/Thread;->holdsLock(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_0
goto :goto_0
.line 257
:cond_0
new-instance p0, Ljava/lang/AssertionError;
new-instance v0, Ljava/lang/StringBuilder;
const-string v1, "Thread "
invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;
move-result-object v1
const-string v2, "Thread.currentThread()"
invoke-static {v1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullExpressionValue(Ljava/lang/Object;Ljava/lang/String;)V
invoke-virtual {v1}, Ljava/lang/Thread;->getName()Ljava/lang/String;
move-result-object v1
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v1, " MUST hold lock on "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object p1
invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p0, p1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
:cond_1
:goto_0
iget-object v0, p0, Lokhttp3/internal/connection/RealConnectionPool;->connections:Ljava/util/concurrent/ConcurrentLinkedQueue;
.line 97
invoke-virtual {v0, p1}, Ljava/util/concurrent/ConcurrentLinkedQueue;->add(Ljava/lang/Object;)Z
iget-object v1, p0, Lokhttp3/internal/connection/RealConnectionPool;->cleanupQueue:Lokhttp3/internal/concurrent/TaskQueue;
iget-object p0, p0, Lokhttp3/internal/connection/RealConnectionPool;->cleanupTask:Lokhttp3/internal/connection/RealConnectionPool$cleanupTask$1;
.line 98
move-object v2, p0
check-cast v2, Lokhttp3/internal/concurrent/Task;
const-wide/16 v3, 0x0
const/4 v5, 0x2
const/4 v6, 0x0
invoke-static/range {v1 .. v6}, Lokhttp3/internal/concurrent/TaskQueue;->schedule$default(Lokhttp3/internal/concurrent/TaskQueue;Lokhttp3/internal/concurrent/Task;JILjava/lang/Object;)V
return-void
.end method