Call.smali
.class public Lcom/squareup/okhttp/Call;
.super Ljava/lang/Object;
.source "Call.java"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/squareup/okhttp/Call$ApplicationInterceptorChain;,
Lcom/squareup/okhttp/Call$AsyncCall;
}
.end annotation
# instance fields
.field volatile canceled:Z
.field private final client:Lcom/squareup/okhttp/OkHttpClient;
.field engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
.field private executed:Z
.field originalRequest:Lcom/squareup/okhttp/Request;
# direct methods
.method protected constructor <init>(Lcom/squareup/okhttp/OkHttpClient;Lcom/squareup/okhttp/Request;)V
.registers 3
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 2
invoke-virtual {p1}, Lcom/squareup/okhttp/OkHttpClient;->copyWithDefaults()Lcom/squareup/okhttp/OkHttpClient;
move-result-object p1
iput-object p1, p0, Lcom/squareup/okhttp/Call;->client:Lcom/squareup/okhttp/OkHttpClient;
.line 3
iput-object p2, p0, Lcom/squareup/okhttp/Call;->originalRequest:Lcom/squareup/okhttp/Request;
return-void
.end method
.method static synthetic access$100(Lcom/squareup/okhttp/Call;Z)Lcom/squareup/okhttp/Response;
.registers 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
invoke-direct {p0, p1}, Lcom/squareup/okhttp/Call;->getResponseWithInterceptorChain(Z)Lcom/squareup/okhttp/Response;
move-result-object p0
return-object p0
.end method
.method static synthetic access$200(Lcom/squareup/okhttp/Call;)Ljava/lang/String;
.registers 1
.line 1
invoke-direct {p0}, Lcom/squareup/okhttp/Call;->toLoggableString()Ljava/lang/String;
move-result-object p0
return-object p0
.end method
.method static synthetic access$300(Lcom/squareup/okhttp/Call;)Lcom/squareup/okhttp/OkHttpClient;
.registers 1
.line 1
iget-object p0, p0, Lcom/squareup/okhttp/Call;->client:Lcom/squareup/okhttp/OkHttpClient;
return-object p0
.end method
.method private getResponseWithInterceptorChain(Z)Lcom/squareup/okhttp/Response;
.registers 5
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
new-instance v0, Lcom/squareup/okhttp/Call$ApplicationInterceptorChain;
iget-object v1, p0, Lcom/squareup/okhttp/Call;->originalRequest:Lcom/squareup/okhttp/Request;
const/4 v2, 0x0
invoke-direct {v0, p0, v2, v1, p1}, Lcom/squareup/okhttp/Call$ApplicationInterceptorChain;-><init>(Lcom/squareup/okhttp/Call;ILcom/squareup/okhttp/Request;Z)V
.line 2
iget-object p1, p0, Lcom/squareup/okhttp/Call;->originalRequest:Lcom/squareup/okhttp/Request;
invoke-interface {v0, p1}, Lcom/squareup/okhttp/Interceptor$Chain;->proceed(Lcom/squareup/okhttp/Request;)Lcom/squareup/okhttp/Response;
move-result-object p1
return-object p1
.end method
.method private toLoggableString()Ljava/lang/String;
.registers 4
.line 1
iget-boolean v0, p0, Lcom/squareup/okhttp/Call;->canceled:Z
if-eqz v0, :cond_7
const-string v0, "canceled call"
goto :goto_9
:cond_7
const-string v0, "call"
.line 2
:goto_9
iget-object v1, p0, Lcom/squareup/okhttp/Call;->originalRequest:Lcom/squareup/okhttp/Request;
invoke-virtual {v1}, Lcom/squareup/okhttp/Request;->httpUrl()Lcom/squareup/okhttp/HttpUrl;
move-result-object v1
const-string v2, "/..."
invoke-virtual {v1, v2}, Lcom/squareup/okhttp/HttpUrl;->resolve(Ljava/lang/String;)Lcom/squareup/okhttp/HttpUrl;
move-result-object v1
.line 3
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
const-string v0, " to "
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v2, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
return-object v0
.end method
# virtual methods
.method public cancel()V
.registers 2
const/4 v0, 0x1
.line 1
iput-boolean v0, p0, Lcom/squareup/okhttp/Call;->canceled:Z
.line 2
iget-object v0, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
if-eqz v0, :cond_a
invoke-virtual {v0}, Lcom/squareup/okhttp/internal/http/HttpEngine;->disconnect()V
:cond_a
return-void
.end method
.method public enqueue(Lcom/squareup/okhttp/Callback;)V
.registers 3
const/4 v0, 0x0
.line 1
invoke-virtual {p0, p1, v0}, Lcom/squareup/okhttp/Call;->enqueue(Lcom/squareup/okhttp/Callback;Z)V
return-void
.end method
.method enqueue(Lcom/squareup/okhttp/Callback;Z)V
.registers 6
.line 2
monitor-enter p0
.line 3
:try_start_1
iget-boolean v0, p0, Lcom/squareup/okhttp/Call;->executed:Z
if-nez v0, :cond_19
const/4 v0, 0x1
.line 4
iput-boolean v0, p0, Lcom/squareup/okhttp/Call;->executed:Z
.line 5
monitor-exit p0
:try_end_9
.catchall {:try_start_1 .. :try_end_9} :catchall_21
.line 6
iget-object v0, p0, Lcom/squareup/okhttp/Call;->client:Lcom/squareup/okhttp/OkHttpClient;
invoke-virtual {v0}, Lcom/squareup/okhttp/OkHttpClient;->getDispatcher()Lcom/squareup/okhttp/Dispatcher;
move-result-object v0
new-instance v1, Lcom/squareup/okhttp/Call$AsyncCall;
const/4 v2, 0x0
invoke-direct {v1, p0, p1, p2, v2}, Lcom/squareup/okhttp/Call$AsyncCall;-><init>(Lcom/squareup/okhttp/Call;Lcom/squareup/okhttp/Callback;ZLcom/squareup/okhttp/Call$1;)V
invoke-virtual {v0, v1}, Lcom/squareup/okhttp/Dispatcher;->enqueue(Lcom/squareup/okhttp/Call$AsyncCall;)V
return-void
.line 7
:cond_19
:try_start_19
new-instance p1, Ljava/lang/IllegalStateException;
const-string p2, "Already Executed"
invoke-direct {p1, p2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw p1
:catchall_21
move-exception p1
.line 8
monitor-exit p0
:try_end_23
.catchall {:try_start_19 .. :try_end_23} :catchall_21
throw p1
.end method
.method public execute()Lcom/squareup/okhttp/Response;
.registers 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
monitor-enter p0
.line 2
:try_start_1
iget-boolean v0, p0, Lcom/squareup/okhttp/Call;->executed:Z
if-nez v0, :cond_36
const/4 v0, 0x1
.line 3
iput-boolean v0, p0, Lcom/squareup/okhttp/Call;->executed:Z
.line 4
monitor-exit p0
:try_end_9
.catchall {:try_start_1 .. :try_end_9} :catchall_3e
.line 5
:try_start_9
iget-object v0, p0, Lcom/squareup/okhttp/Call;->client:Lcom/squareup/okhttp/OkHttpClient;
invoke-virtual {v0}, Lcom/squareup/okhttp/OkHttpClient;->getDispatcher()Lcom/squareup/okhttp/Dispatcher;
move-result-object v0
invoke-virtual {v0, p0}, Lcom/squareup/okhttp/Dispatcher;->executed(Lcom/squareup/okhttp/Call;)V
const/4 v0, 0x0
.line 6
invoke-direct {p0, v0}, Lcom/squareup/okhttp/Call;->getResponseWithInterceptorChain(Z)Lcom/squareup/okhttp/Response;
move-result-object v0
:try_end_17
.catchall {:try_start_9 .. :try_end_17} :catchall_2b
if-eqz v0, :cond_23
.line 7
iget-object v1, p0, Lcom/squareup/okhttp/Call;->client:Lcom/squareup/okhttp/OkHttpClient;
invoke-virtual {v1}, Lcom/squareup/okhttp/OkHttpClient;->getDispatcher()Lcom/squareup/okhttp/Dispatcher;
move-result-object v1
invoke-virtual {v1, p0}, Lcom/squareup/okhttp/Dispatcher;->finished(Lcom/squareup/okhttp/Call;)V
return-object v0
.line 8
:cond_23
:try_start_23
new-instance v0, Ljava/io/IOException;
const-string v1, "Canceled"
invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v0
:try_end_2b
.catchall {:try_start_23 .. :try_end_2b} :catchall_2b
:catchall_2b
move-exception v0
.line 9
iget-object v1, p0, Lcom/squareup/okhttp/Call;->client:Lcom/squareup/okhttp/OkHttpClient;
invoke-virtual {v1}, Lcom/squareup/okhttp/OkHttpClient;->getDispatcher()Lcom/squareup/okhttp/Dispatcher;
move-result-object v1
invoke-virtual {v1, p0}, Lcom/squareup/okhttp/Dispatcher;->finished(Lcom/squareup/okhttp/Call;)V
throw v0
.line 10
:cond_36
:try_start_36
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "Already Executed"
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
:catchall_3e
move-exception v0
.line 11
monitor-exit p0
:try_end_40
.catchall {:try_start_36 .. :try_end_40} :catchall_3e
throw v0
.end method
.method getResponse(Lcom/squareup/okhttp/Request;Z)Lcom/squareup/okhttp/Response;
.registers 14
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
invoke-virtual {p1}, Lcom/squareup/okhttp/Request;->body()Lcom/squareup/okhttp/RequestBody;
move-result-object v0
if-eqz v0, :cond_3e
.line 2
invoke-virtual {p1}, Lcom/squareup/okhttp/Request;->newBuilder()Lcom/squareup/okhttp/Request$Builder;
move-result-object p1
.line 3
invoke-virtual {v0}, Lcom/squareup/okhttp/RequestBody;->contentType()Lcom/squareup/okhttp/MediaType;
move-result-object v1
if-eqz v1, :cond_19
.line 4
invoke-virtual {v1}, Lcom/squareup/okhttp/MediaType;->toString()Ljava/lang/String;
move-result-object v1
const-string v2, "Content-Type"
invoke-virtual {p1, v2, v1}, Lcom/squareup/okhttp/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lcom/squareup/okhttp/Request$Builder;
.line 5
:cond_19
invoke-virtual {v0}, Lcom/squareup/okhttp/RequestBody;->contentLength()J
move-result-wide v0
const-wide/16 v2, -0x1
const-string v4, "Content-Length"
const-string v5, "Transfer-Encoding"
cmp-long v6, v0, v2
if-eqz v6, :cond_32
.line 6
invoke-static {v0, v1}, Ljava/lang/Long;->toString(J)Ljava/lang/String;
move-result-object v0
invoke-virtual {p1, v4, v0}, Lcom/squareup/okhttp/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lcom/squareup/okhttp/Request$Builder;
.line 7
invoke-virtual {p1, v5}, Lcom/squareup/okhttp/Request$Builder;->removeHeader(Ljava/lang/String;)Lcom/squareup/okhttp/Request$Builder;
goto :goto_3a
:cond_32
const-string v0, "chunked"
.line 8
invoke-virtual {p1, v5, v0}, Lcom/squareup/okhttp/Request$Builder;->header(Ljava/lang/String;Ljava/lang/String;)Lcom/squareup/okhttp/Request$Builder;
.line 9
invoke-virtual {p1, v4}, Lcom/squareup/okhttp/Request$Builder;->removeHeader(Ljava/lang/String;)Lcom/squareup/okhttp/Request$Builder;
.line 10
:goto_3a
invoke-virtual {p1}, Lcom/squareup/okhttp/Request$Builder;->build()Lcom/squareup/okhttp/Request;
move-result-object p1
:cond_3e
move-object v2, p1
.line 11
new-instance p1, Lcom/squareup/okhttp/internal/http/HttpEngine;
iget-object v1, p0, Lcom/squareup/okhttp/Call;->client:Lcom/squareup/okhttp/OkHttpClient;
const/4 v3, 0x0
const/4 v4, 0x0
const/4 v6, 0x0
const/4 v7, 0x0
const/4 v8, 0x0
const/4 v9, 0x0
move-object v0, p1
move v5, p2
invoke-direct/range {v0 .. v9}, Lcom/squareup/okhttp/internal/http/HttpEngine;-><init>(Lcom/squareup/okhttp/OkHttpClient;Lcom/squareup/okhttp/Request;ZZZLcom/squareup/okhttp/Connection;Lcom/squareup/okhttp/internal/http/RouteSelector;Lcom/squareup/okhttp/internal/http/RetryableSink;Lcom/squareup/okhttp/Response;)V
iput-object p1, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
const/4 p1, 0x0
.line 12
:goto_51
iget-boolean v0, p0, Lcom/squareup/okhttp/Call;->canceled:Z
if-nez v0, :cond_df
.line 13
:try_start_55
iget-object v0, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
invoke-virtual {v0}, Lcom/squareup/okhttp/internal/http/HttpEngine;->sendRequest()V
.line 14
iget-object v0, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
invoke-virtual {v0}, Lcom/squareup/okhttp/internal/http/HttpEngine;->readResponse()V
:try_end_5f
.catch Lcom/squareup/okhttp/internal/http/RequestException; {:try_start_55 .. :try_end_5f} :catch_d9
.catch Lcom/squareup/okhttp/internal/http/RouteException; {:try_start_55 .. :try_end_5f} :catch_c7
.catch Ljava/io/IOException; {:try_start_55 .. :try_end_5f} :catch_b9
.line 15
iget-object v0, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
invoke-virtual {v0}, Lcom/squareup/okhttp/internal/http/HttpEngine;->getResponse()Lcom/squareup/okhttp/Response;
move-result-object v10
.line 16
iget-object v0, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
invoke-virtual {v0}, Lcom/squareup/okhttp/internal/http/HttpEngine;->followUpRequest()Lcom/squareup/okhttp/Request;
move-result-object v3
if-nez v3, :cond_75
if-nez p2, :cond_74
.line 17
iget-object p1, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
invoke-virtual {p1}, Lcom/squareup/okhttp/internal/http/HttpEngine;->releaseConnection()V
:cond_74
return-object v10
:cond_75
add-int/lit8 p1, p1, 0x1
const/16 v0, 0x14
if-gt p1, v0, :cond_a2
.line 18
iget-object v0, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
invoke-virtual {v3}, Lcom/squareup/okhttp/Request;->httpUrl()Lcom/squareup/okhttp/HttpUrl;
move-result-object v1
invoke-virtual {v0, v1}, Lcom/squareup/okhttp/internal/http/HttpEngine;->sameConnection(Lcom/squareup/okhttp/HttpUrl;)Z
move-result v0
if-nez v0, :cond_8c
.line 19
iget-object v0, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
invoke-virtual {v0}, Lcom/squareup/okhttp/internal/http/HttpEngine;->releaseConnection()V
.line 20
:cond_8c
iget-object v0, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
invoke-virtual {v0}, Lcom/squareup/okhttp/internal/http/HttpEngine;->close()Lcom/squareup/okhttp/Connection;
move-result-object v7
.line 21
new-instance v0, Lcom/squareup/okhttp/internal/http/HttpEngine;
iget-object v2, p0, Lcom/squareup/okhttp/Call;->client:Lcom/squareup/okhttp/OkHttpClient;
const/4 v4, 0x0
const/4 v5, 0x0
const/4 v8, 0x0
const/4 v9, 0x0
move-object v1, v0
move v6, p2
invoke-direct/range {v1 .. v10}, Lcom/squareup/okhttp/internal/http/HttpEngine;-><init>(Lcom/squareup/okhttp/OkHttpClient;Lcom/squareup/okhttp/Request;ZZZLcom/squareup/okhttp/Connection;Lcom/squareup/okhttp/internal/http/RouteSelector;Lcom/squareup/okhttp/internal/http/RetryableSink;Lcom/squareup/okhttp/Response;)V
iput-object v0, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
goto :goto_51
.line 22
:cond_a2
new-instance p2, Ljava/net/ProtocolException;
new-instance v0, Ljava/lang/StringBuilder;
invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
const-string v1, "Too many follow-up requests: "
invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p1
invoke-direct {p2, p1}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
throw p2
:catch_b9
move-exception v0
.line 23
iget-object v1, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
const/4 v2, 0x0
invoke-virtual {v1, v0, v2}, Lcom/squareup/okhttp/internal/http/HttpEngine;->recover(Ljava/io/IOException;Lokio/Sink;)Lcom/squareup/okhttp/internal/http/HttpEngine;
move-result-object v1
if-eqz v1, :cond_c6
.line 24
iput-object v1, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
goto :goto_51
.line 25
:cond_c6
throw v0
:catch_c7
move-exception v0
.line 26
iget-object v1, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
invoke-virtual {v1, v0}, Lcom/squareup/okhttp/internal/http/HttpEngine;->recover(Lcom/squareup/okhttp/internal/http/RouteException;)Lcom/squareup/okhttp/internal/http/HttpEngine;
move-result-object v1
if-eqz v1, :cond_d4
.line 27
iput-object v1, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
goto/16 :goto_51
.line 28
:cond_d4
invoke-virtual {v0}, Lcom/squareup/okhttp/internal/http/RouteException;->getLastConnectException()Ljava/io/IOException;
move-result-object p1
throw p1
:catch_d9
move-exception p1
.line 29
invoke-virtual {p1}, Lcom/squareup/okhttp/internal/http/RequestException;->getCause()Ljava/io/IOException;
move-result-object p1
throw p1
.line 30
:cond_df
iget-object p1, p0, Lcom/squareup/okhttp/Call;->engine:Lcom/squareup/okhttp/internal/http/HttpEngine;
invoke-virtual {p1}, Lcom/squareup/okhttp/internal/http/HttpEngine;->releaseConnection()V
.line 31
new-instance p1, Ljava/io/IOException;
const-string p2, "Canceled"
invoke-direct {p1, p2}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
goto :goto_ed
:goto_ec
throw p1
:goto_ed
goto :goto_ec
.end method
.method public isCanceled()Z
.registers 2
.line 1
iget-boolean v0, p0, Lcom/squareup/okhttp/Call;->canceled:Z
return v0
.end method
.method tag()Ljava/lang/Object;
.registers 2
.line 1
iget-object v0, p0, Lcom/squareup/okhttp/Call;->originalRequest:Lcom/squareup/okhttp/Request;
invoke-virtual {v0}, Lcom/squareup/okhttp/Request;->tag()Ljava/lang/Object;
move-result-object v0
return-object v0
.end method