apkfuckery/com.discord/smali/okhttp3/internal/http/StreamAllocation.smali
2019-02-04 21:05:16 +01:00

1067 lines
29 KiB
Smali

.class public final Lokhttp3/internal/http/StreamAllocation;
.super Ljava/lang/Object;
.source "StreamAllocation.java"
# instance fields
.field public final address:Lokhttp3/Address;
.field private canceled:Z
.field private connection:Lokhttp3/internal/io/RealConnection;
.field private final connectionPool:Lokhttp3/ConnectionPool;
.field private released:Z
.field private route:Lokhttp3/Route;
.field private routeSelector:Lokhttp3/internal/http/RouteSelector;
.field private stream:Lokhttp3/internal/http/HttpStream;
# direct methods
.method public constructor <init>(Lokhttp3/ConnectionPool;Lokhttp3/Address;)V
.locals 2
.param p1, "connectionPool" # Lokhttp3/ConnectionPool;
.param p2, "address" # Lokhttp3/Address;
.prologue
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-object p1, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
iput-object p2, p0, Lokhttp3/internal/http/StreamAllocation;->address:Lokhttp3/Address;
new-instance v0, Lokhttp3/internal/http/RouteSelector;
invoke-direct {p0}, Lokhttp3/internal/http/StreamAllocation;->routeDatabase()Lokhttp3/internal/RouteDatabase;
move-result-object v1
invoke-direct {v0, p2, v1}, Lokhttp3/internal/http/RouteSelector;-><init>(Lokhttp3/Address;Lokhttp3/internal/RouteDatabase;)V
iput-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->routeSelector:Lokhttp3/internal/http/RouteSelector;
return-void
.end method
.method private deallocate(ZZZ)V
.locals 6
.param p1, "noNewStreams" # Z
.param p2, "released" # Z
.param p3, "streamFinished" # Z
.prologue
const/4 v0, 0x0
.local v0, "connectionToClose":Lokhttp3/internal/io/RealConnection;
iget-object v2, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
monitor-enter v2
if-eqz p3, :cond_0
const/4 v1, 0x0
:try_start_0
iput-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->stream:Lokhttp3/internal/http/HttpStream;
:cond_0
if-eqz p2, :cond_1
const/4 v1, 0x1
iput-boolean v1, p0, Lokhttp3/internal/http/StreamAllocation;->released:Z
:cond_1
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
if-eqz v1, :cond_5
if-eqz p1, :cond_2
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
const/4 v3, 0x1
iput-boolean v3, v1, Lokhttp3/internal/io/RealConnection;->noNewStreams:Z
:cond_2
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->stream:Lokhttp3/internal/http/HttpStream;
if-nez v1, :cond_5
iget-boolean v1, p0, Lokhttp3/internal/http/StreamAllocation;->released:Z
if-nez v1, :cond_3
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
iget-boolean v1, v1, Lokhttp3/internal/io/RealConnection;->noNewStreams:Z
if-eqz v1, :cond_5
:cond_3
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
invoke-direct {p0, v1}, Lokhttp3/internal/http/StreamAllocation;->release(Lokhttp3/internal/io/RealConnection;)V
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
iget-object v1, v1, Lokhttp3/internal/io/RealConnection;->allocations:Ljava/util/List;
invoke-interface {v1}, Ljava/util/List;->isEmpty()Z
move-result v1
if-eqz v1, :cond_4
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
invoke-static {}, Ljava/lang/System;->nanoTime()J
move-result-wide v4
iput-wide v4, v1, Lokhttp3/internal/io/RealConnection;->idleAtNanos:J
sget-object v1, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
iget-object v3, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
iget-object v4, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
invoke-virtual {v1, v3, v4}, Lokhttp3/internal/Internal;->connectionBecameIdle(Lokhttp3/ConnectionPool;Lokhttp3/internal/io/RealConnection;)Z
move-result v1
if-eqz v1, :cond_4
iget-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
:cond_4
const/4 v1, 0x0
iput-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
:cond_5
monitor-exit v2
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz v0, :cond_6
invoke-virtual {v0}, Lokhttp3/internal/io/RealConnection;->socket()Ljava/net/Socket;
move-result-object v1
invoke-static {v1}, Lokhttp3/internal/Util;->closeQuietly(Ljava/net/Socket;)V
:cond_6
return-void
:catchall_0
move-exception v1
:try_start_1
monitor-exit v2
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v1
.end method
.method private findConnection(IIIZ)Lokhttp3/internal/io/RealConnection;
.locals 9
.param p1, "connectTimeout" # I
.param p2, "readTimeout" # I
.param p3, "writeTimeout" # I
.param p4, "connectionRetryEnabled" # Z
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Lokhttp3/internal/http/RouteException;
}
.end annotation
.prologue
iget-object v2, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
monitor-enter v2
:try_start_0
iget-boolean v1, p0, Lokhttp3/internal/http/StreamAllocation;->released:Z
if-eqz v1, :cond_0
new-instance v1, Ljava/lang/IllegalStateException;
const-string v3, "released"
invoke-direct {v1, v3}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v1
:catchall_0
move-exception v1
monitor-exit v2
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw v1
:cond_0
:try_start_1
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->stream:Lokhttp3/internal/http/HttpStream;
if-eqz v1, :cond_1
new-instance v1, Ljava/lang/IllegalStateException;
const-string v3, "stream != null"
invoke-direct {v1, v3}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v1
:cond_1
iget-boolean v1, p0, Lokhttp3/internal/http/StreamAllocation;->canceled:Z
if-eqz v1, :cond_2
new-instance v1, Ljava/io/IOException;
const-string v3, "Canceled"
invoke-direct {v1, v3}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v1
:cond_2
iget-object v6, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
.local v6, "allocatedConnection":Lokhttp3/internal/io/RealConnection;
if-eqz v6, :cond_3
iget-boolean v1, v6, Lokhttp3/internal/io/RealConnection;->noNewStreams:Z
if-nez v1, :cond_3
monitor-exit v2
.end local v6 # "allocatedConnection":Lokhttp3/internal/io/RealConnection;
:goto_0
return-object v6
.restart local v6 # "allocatedConnection":Lokhttp3/internal/io/RealConnection;
:cond_3
sget-object v1, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
iget-object v3, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
iget-object v4, p0, Lokhttp3/internal/http/StreamAllocation;->address:Lokhttp3/Address;
invoke-virtual {v1, v3, v4, p0}, Lokhttp3/internal/Internal;->get(Lokhttp3/ConnectionPool;Lokhttp3/Address;Lokhttp3/internal/http/StreamAllocation;)Lokhttp3/internal/io/RealConnection;
move-result-object v7
.local v7, "pooledConnection":Lokhttp3/internal/io/RealConnection;
if-eqz v7, :cond_4
iput-object v7, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
monitor-exit v2
move-object v6, v7
goto :goto_0
:cond_4
iget-object v8, p0, Lokhttp3/internal/http/StreamAllocation;->route:Lokhttp3/Route;
.local v8, "selectedRoute":Lokhttp3/Route;
monitor-exit v2
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
if-nez v8, :cond_5
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->routeSelector:Lokhttp3/internal/http/RouteSelector;
invoke-virtual {v1}, Lokhttp3/internal/http/RouteSelector;->next()Lokhttp3/Route;
move-result-object v8
iget-object v2, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
monitor-enter v2
:try_start_2
iput-object v8, p0, Lokhttp3/internal/http/StreamAllocation;->route:Lokhttp3/Route;
monitor-exit v2
:try_end_2
.catchall {:try_start_2 .. :try_end_2} :catchall_2
:cond_5
new-instance v0, Lokhttp3/internal/io/RealConnection;
invoke-direct {v0, v8}, Lokhttp3/internal/io/RealConnection;-><init>(Lokhttp3/Route;)V
.local v0, "newConnection":Lokhttp3/internal/io/RealConnection;
invoke-virtual {p0, v0}, Lokhttp3/internal/http/StreamAllocation;->acquire(Lokhttp3/internal/io/RealConnection;)V
iget-object v2, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
monitor-enter v2
:try_start_3
sget-object v1, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
iget-object v3, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
invoke-virtual {v1, v3, v0}, Lokhttp3/internal/Internal;->put(Lokhttp3/ConnectionPool;Lokhttp3/internal/io/RealConnection;)V
iput-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
iget-boolean v1, p0, Lokhttp3/internal/http/StreamAllocation;->canceled:Z
if-eqz v1, :cond_6
new-instance v1, Ljava/io/IOException;
const-string v3, "Canceled"
invoke-direct {v1, v3}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v1
:catchall_1
move-exception v1
monitor-exit v2
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_1
throw v1
.end local v0 # "newConnection":Lokhttp3/internal/io/RealConnection;
:catchall_2
move-exception v1
:try_start_4
monitor-exit v2
:try_end_4
.catchall {:try_start_4 .. :try_end_4} :catchall_2
throw v1
.restart local v0 # "newConnection":Lokhttp3/internal/io/RealConnection;
:cond_6
:try_start_5
monitor-exit v2
:try_end_5
.catchall {:try_start_5 .. :try_end_5} :catchall_1
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->address:Lokhttp3/Address;
invoke-virtual {v1}, Lokhttp3/Address;->connectionSpecs()Ljava/util/List;
move-result-object v4
move v1, p1
move v2, p2
move v3, p3
move v5, p4
invoke-virtual/range {v0 .. v5}, Lokhttp3/internal/io/RealConnection;->connect(IIILjava/util/List;Z)V
invoke-direct {p0}, Lokhttp3/internal/http/StreamAllocation;->routeDatabase()Lokhttp3/internal/RouteDatabase;
move-result-object v1
invoke-virtual {v0}, Lokhttp3/internal/io/RealConnection;->route()Lokhttp3/Route;
move-result-object v2
invoke-virtual {v1, v2}, Lokhttp3/internal/RouteDatabase;->connected(Lokhttp3/Route;)V
move-object v6, v0
goto :goto_0
.end method
.method private findHealthyConnection(IIIZZ)Lokhttp3/internal/io/RealConnection;
.locals 3
.param p1, "connectTimeout" # I
.param p2, "readTimeout" # I
.param p3, "writeTimeout" # I
.param p4, "connectionRetryEnabled" # Z
.param p5, "doExtensiveHealthChecks" # Z
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Lokhttp3/internal/http/RouteException;
}
.end annotation
.prologue
:goto_0
invoke-direct {p0, p1, p2, p3, p4}, Lokhttp3/internal/http/StreamAllocation;->findConnection(IIIZ)Lokhttp3/internal/io/RealConnection;
move-result-object v0
.local v0, "candidate":Lokhttp3/internal/io/RealConnection;
iget-object v2, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
monitor-enter v2
:try_start_0
iget v1, v0, Lokhttp3/internal/io/RealConnection;->successCount:I
if-nez v1, :cond_1
monitor-exit v2
:cond_0
return-object v0
:cond_1
monitor-exit v2
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
invoke-virtual {v0, p5}, Lokhttp3/internal/io/RealConnection;->isHealthy(Z)Z
move-result v1
if-nez v1, :cond_0
new-instance v1, Ljava/io/IOException;
invoke-direct {v1}, Ljava/io/IOException;-><init>()V
invoke-virtual {p0, v1}, Lokhttp3/internal/http/StreamAllocation;->connectionFailed(Ljava/io/IOException;)V
goto :goto_0
:catchall_0
move-exception v1
:try_start_1
monitor-exit v2
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v1
.end method
.method private isRecoverable(Ljava/io/IOException;)Z
.locals 2
.param p1, "e" # Ljava/io/IOException;
.prologue
const/4 v0, 0x0
instance-of v1, p1, Ljava/net/ProtocolException;
if-eqz v1, :cond_1
:cond_0
:goto_0
return v0
:cond_1
instance-of v1, p1, Ljava/io/InterruptedIOException;
if-eqz v1, :cond_2
instance-of v0, p1, Ljava/net/SocketTimeoutException;
goto :goto_0
:cond_2
instance-of v1, p1, Ljavax/net/ssl/SSLHandshakeException;
if-eqz v1, :cond_3
invoke-virtual {p1}, Ljava/io/IOException;->getCause()Ljava/lang/Throwable;
move-result-object v1
instance-of v1, v1, Ljava/security/cert/CertificateException;
if-nez v1, :cond_0
:cond_3
instance-of v1, p1, Ljavax/net/ssl/SSLPeerUnverifiedException;
if-nez v1, :cond_0
const/4 v0, 0x1
goto :goto_0
.end method
.method private release(Lokhttp3/internal/io/RealConnection;)V
.locals 4
.param p1, "connection" # Lokhttp3/internal/io/RealConnection;
.prologue
const/4 v0, 0x0
.local v0, "i":I
iget-object v3, p1, Lokhttp3/internal/io/RealConnection;->allocations:Ljava/util/List;
invoke-interface {v3}, Ljava/util/List;->size()I
move-result v2
.local v2, "size":I
:goto_0
if-ge v0, v2, :cond_1
iget-object v3, p1, Lokhttp3/internal/io/RealConnection;->allocations:Ljava/util/List;
invoke-interface {v3, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;
move-result-object v1
check-cast v1, Ljava/lang/ref/Reference;
.local v1, "reference":Ljava/lang/ref/Reference;, "Ljava/lang/ref/Reference<Lokhttp3/internal/http/StreamAllocation;>;"
invoke-virtual {v1}, Ljava/lang/ref/Reference;->get()Ljava/lang/Object;
move-result-object v3
if-ne v3, p0, :cond_0
iget-object v3, p1, Lokhttp3/internal/io/RealConnection;->allocations:Ljava/util/List;
invoke-interface {v3, v0}, Ljava/util/List;->remove(I)Ljava/lang/Object;
return-void
:cond_0
add-int/lit8 v0, v0, 0x1
goto :goto_0
.end local v1 # "reference":Ljava/lang/ref/Reference;, "Ljava/lang/ref/Reference<Lokhttp3/internal/http/StreamAllocation;>;"
:cond_1
new-instance v3, Ljava/lang/IllegalStateException;
invoke-direct {v3}, Ljava/lang/IllegalStateException;-><init>()V
throw v3
.end method
.method private routeDatabase()Lokhttp3/internal/RouteDatabase;
.locals 2
.prologue
sget-object v0, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
invoke-virtual {v0, v1}, Lokhttp3/internal/Internal;->routeDatabase(Lokhttp3/ConnectionPool;)Lokhttp3/internal/RouteDatabase;
move-result-object v0
return-object v0
.end method
# virtual methods
.method public acquire(Lokhttp3/internal/io/RealConnection;)V
.locals 2
.param p1, "connection" # Lokhttp3/internal/io/RealConnection;
.prologue
iget-object v0, p1, Lokhttp3/internal/io/RealConnection;->allocations:Ljava/util/List;
new-instance v1, Ljava/lang/ref/WeakReference;
invoke-direct {v1, p0}, Ljava/lang/ref/WeakReference;-><init>(Ljava/lang/Object;)V
invoke-interface {v0, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
return-void
.end method
.method public cancel()V
.locals 4
.prologue
iget-object v3, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
monitor-enter v3
const/4 v2, 0x1
:try_start_0
iput-boolean v2, p0, Lokhttp3/internal/http/StreamAllocation;->canceled:Z
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->stream:Lokhttp3/internal/http/HttpStream;
.local v1, "streamToCancel":Lokhttp3/internal/http/HttpStream;
iget-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
.local v0, "connectionToCancel":Lokhttp3/internal/io/RealConnection;
monitor-exit v3
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
if-eqz v1, :cond_1
invoke-interface {v1}, Lokhttp3/internal/http/HttpStream;->cancel()V
:cond_0
:goto_0
return-void
.end local v0 # "connectionToCancel":Lokhttp3/internal/io/RealConnection;
.end local v1 # "streamToCancel":Lokhttp3/internal/http/HttpStream;
:catchall_0
move-exception v2
:try_start_1
monitor-exit v3
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v2
.restart local v0 # "connectionToCancel":Lokhttp3/internal/io/RealConnection;
.restart local v1 # "streamToCancel":Lokhttp3/internal/http/HttpStream;
:cond_1
if-eqz v0, :cond_0
invoke-virtual {v0}, Lokhttp3/internal/io/RealConnection;->cancel()V
goto :goto_0
.end method
.method public declared-synchronized connection()Lokhttp3/internal/io/RealConnection;
.locals 1
.prologue
monitor-enter p0
:try_start_0
iget-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
monitor-exit p0
return-object v0
:catchall_0
move-exception v0
monitor-exit p0
throw v0
.end method
.method public connectionFailed(Ljava/io/IOException;)V
.locals 4
.param p1, "e" # Ljava/io/IOException;
.prologue
const/4 v3, 0x1
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
monitor-enter v1
:try_start_0
iget-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
if-eqz v0, :cond_1
iget-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
iget v0, v0, Lokhttp3/internal/io/RealConnection;->successCount:I
if-nez v0, :cond_1
iget-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->route:Lokhttp3/Route;
if-eqz v0, :cond_0
if-eqz p1, :cond_0
iget-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->routeSelector:Lokhttp3/internal/http/RouteSelector;
iget-object v2, p0, Lokhttp3/internal/http/StreamAllocation;->route:Lokhttp3/Route;
invoke-virtual {v0, v2, p1}, Lokhttp3/internal/http/RouteSelector;->connectFailed(Lokhttp3/Route;Ljava/io/IOException;)V
:cond_0
const/4 v0, 0x0
iput-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->route:Lokhttp3/Route;
:cond_1
monitor-exit v1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
const/4 v0, 0x0
invoke-direct {p0, v3, v0, v3}, Lokhttp3/internal/http/StreamAllocation;->deallocate(ZZZ)V
return-void
:catchall_0
move-exception v0
:try_start_1
monitor-exit v1
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
throw v0
.end method
.method public newStream(IIIZZ)Lokhttp3/internal/http/HttpStream;
.locals 7
.param p1, "connectTimeout" # I
.param p2, "readTimeout" # I
.param p3, "writeTimeout" # I
.param p4, "connectionRetryEnabled" # Z
.param p5, "doExtensiveHealthChecks" # Z
.annotation system Ldalvik/annotation/Throws;
value = {
Lokhttp3/internal/http/RouteException;,
Ljava/io/IOException;
}
.end annotation
.prologue
:try_start_0
invoke-direct/range {p0 .. p5}, Lokhttp3/internal/http/StreamAllocation;->findHealthyConnection(IIIZZ)Lokhttp3/internal/io/RealConnection;
move-result-object v1
.local v1, "resultConnection":Lokhttp3/internal/io/RealConnection;
iget-object v3, v1, Lokhttp3/internal/io/RealConnection;->framedConnection:Lokhttp3/internal/framed/FramedConnection;
if-eqz v3, :cond_0
new-instance v2, Lokhttp3/internal/http/Http2xStream;
iget-object v3, v1, Lokhttp3/internal/io/RealConnection;->framedConnection:Lokhttp3/internal/framed/FramedConnection;
invoke-direct {v2, p0, v3}, Lokhttp3/internal/http/Http2xStream;-><init>(Lokhttp3/internal/http/StreamAllocation;Lokhttp3/internal/framed/FramedConnection;)V
.local v2, "resultStream":Lokhttp3/internal/http/HttpStream;
:goto_0
iget-object v4, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
monitor-enter v4
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
:try_start_1
iput-object v2, p0, Lokhttp3/internal/http/StreamAllocation;->stream:Lokhttp3/internal/http/HttpStream;
monitor-exit v4
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
return-object v2
.end local v2 # "resultStream":Lokhttp3/internal/http/HttpStream;
:cond_0
:try_start_2
invoke-virtual {v1}, Lokhttp3/internal/io/RealConnection;->socket()Ljava/net/Socket;
move-result-object v3
invoke-virtual {v3, p2}, Ljava/net/Socket;->setSoTimeout(I)V
iget-object v3, v1, Lokhttp3/internal/io/RealConnection;->source:Lokio/BufferedSource;
invoke-interface {v3}, Lokio/BufferedSource;->timeout()Lokio/Timeout;
move-result-object v3
int-to-long v4, p2
sget-object v6, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
invoke-virtual {v3, v4, v5, v6}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout;
iget-object v3, v1, Lokhttp3/internal/io/RealConnection;->sink:Lokio/BufferedSink;
invoke-interface {v3}, Lokio/BufferedSink;->timeout()Lokio/Timeout;
move-result-object v3
int-to-long v4, p3
sget-object v6, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
invoke-virtual {v3, v4, v5, v6}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout;
new-instance v2, Lokhttp3/internal/http/Http1xStream;
iget-object v3, v1, Lokhttp3/internal/io/RealConnection;->source:Lokio/BufferedSource;
iget-object v4, v1, Lokhttp3/internal/io/RealConnection;->sink:Lokio/BufferedSink;
invoke-direct {v2, p0, v3, v4}, Lokhttp3/internal/http/Http1xStream;-><init>(Lokhttp3/internal/http/StreamAllocation;Lokio/BufferedSource;Lokio/BufferedSink;)V
:try_end_2
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_0
.restart local v2 # "resultStream":Lokhttp3/internal/http/HttpStream;
goto :goto_0
:catchall_0
move-exception v3
:try_start_3
monitor-exit v4
:try_end_3
.catchall {:try_start_3 .. :try_end_3} :catchall_0
:try_start_4
throw v3
:try_end_4
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_0
.end local v1 # "resultConnection":Lokhttp3/internal/io/RealConnection;
.end local v2 # "resultStream":Lokhttp3/internal/http/HttpStream;
:catch_0
move-exception v0
.local v0, "e":Ljava/io/IOException;
new-instance v3, Lokhttp3/internal/http/RouteException;
invoke-direct {v3, v0}, Lokhttp3/internal/http/RouteException;-><init>(Ljava/io/IOException;)V
throw v3
.end method
.method public noNewStreams()V
.locals 2
.prologue
const/4 v1, 0x0
const/4 v0, 0x1
invoke-direct {p0, v0, v1, v1}, Lokhttp3/internal/http/StreamAllocation;->deallocate(ZZZ)V
return-void
.end method
.method public recover(Ljava/io/IOException;Lokio/Sink;)Z
.locals 4
.param p1, "e" # Ljava/io/IOException;
.param p2, "requestBodyOut" # Lokio/Sink;
.prologue
const/4 v2, 0x1
const/4 v1, 0x0
iget-object v3, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
if-eqz v3, :cond_0
invoke-virtual {p0, p1}, Lokhttp3/internal/http/StreamAllocation;->connectionFailed(Ljava/io/IOException;)V
:cond_0
if-eqz p2, :cond_1
instance-of v3, p2, Lokhttp3/internal/http/RetryableSink;
if-eqz v3, :cond_5
:cond_1
move v0, v2
.local v0, "canRetryRequestBody":Z
:goto_0
iget-object v3, p0, Lokhttp3/internal/http/StreamAllocation;->routeSelector:Lokhttp3/internal/http/RouteSelector;
if-eqz v3, :cond_2
iget-object v3, p0, Lokhttp3/internal/http/StreamAllocation;->routeSelector:Lokhttp3/internal/http/RouteSelector;
invoke-virtual {v3}, Lokhttp3/internal/http/RouteSelector;->hasNext()Z
move-result v3
if-eqz v3, :cond_3
:cond_2
invoke-direct {p0, p1}, Lokhttp3/internal/http/StreamAllocation;->isRecoverable(Ljava/io/IOException;)Z
move-result v3
if-eqz v3, :cond_3
if-nez v0, :cond_4
:cond_3
move v2, v1
:cond_4
return v2
.end local v0 # "canRetryRequestBody":Z
:cond_5
move v0, v1
goto :goto_0
.end method
.method public release()V
.locals 2
.prologue
const/4 v1, 0x0
const/4 v0, 0x1
invoke-direct {p0, v1, v0, v1}, Lokhttp3/internal/http/StreamAllocation;->deallocate(ZZZ)V
return-void
.end method
.method public stream()Lokhttp3/internal/http/HttpStream;
.locals 2
.prologue
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
monitor-enter v1
:try_start_0
iget-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->stream:Lokhttp3/internal/http/HttpStream;
monitor-exit v1
return-object v0
:catchall_0
move-exception v0
monitor-exit v1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw v0
.end method
.method public streamFinished(ZLokhttp3/internal/http/HttpStream;)V
.locals 4
.param p1, "noNewStreams" # Z
.param p2, "stream" # Lokhttp3/internal/http/HttpStream;
.prologue
iget-object v1, p0, Lokhttp3/internal/http/StreamAllocation;->connectionPool:Lokhttp3/ConnectionPool;
monitor-enter v1
if-eqz p2, :cond_0
:try_start_0
iget-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->stream:Lokhttp3/internal/http/HttpStream;
if-eq p2, v0, :cond_1
:cond_0
new-instance v0, Ljava/lang/IllegalStateException;
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
const-string v3, "expected "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
iget-object v3, p0, Lokhttp3/internal/http/StreamAllocation;->stream:Lokhttp3/internal/http/HttpStream;
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
const-string v3, " but was "
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-direct {v0, v2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
:catchall_0
move-exception v0
monitor-exit v1
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
throw v0
:cond_1
if-nez p1, :cond_2
:try_start_1
iget-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->connection:Lokhttp3/internal/io/RealConnection;
iget v2, v0, Lokhttp3/internal/io/RealConnection;->successCount:I
add-int/lit8 v2, v2, 0x1
iput v2, v0, Lokhttp3/internal/io/RealConnection;->successCount:I
:cond_2
monitor-exit v1
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
const/4 v0, 0x0
const/4 v1, 0x1
invoke-direct {p0, p1, v0, v1}, Lokhttp3/internal/http/StreamAllocation;->deallocate(ZZZ)V
return-void
.end method
.method public toString()Ljava/lang/String;
.locals 1
.prologue
iget-object v0, p0, Lokhttp3/internal/http/StreamAllocation;->address:Lokhttp3/Address;
invoke-virtual {v0}, Ljava/lang/Object;->toString()Ljava/lang/String;
move-result-object v0
return-object v0
.end method