675 lines
26 KiB
Java
675 lines
26 KiB
Java
|
package okhttp3.internal.connection;
|
||
|
|
||
|
import java.io.IOException;
|
||
|
import java.io.InterruptedIOException;
|
||
|
import java.lang.ref.Reference;
|
||
|
import java.lang.ref.WeakReference;
|
||
|
import java.net.Socket;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Iterator;
|
||
|
import java.util.List;
|
||
|
import java.util.concurrent.ExecutorService;
|
||
|
import java.util.concurrent.RejectedExecutionException;
|
||
|
import java.util.concurrent.TimeUnit;
|
||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||
|
import javax.net.ssl.HostnameVerifier;
|
||
|
import javax.net.ssl.SSLSocketFactory;
|
||
|
import o.C14866gag;
|
||
|
import o.C14881gav;
|
||
|
import o.C14887gbC;
|
||
|
import o.C14957gcv;
|
||
|
import o.ghX;
|
||
|
import okhttp3.Address;
|
||
|
import okhttp3.Call;
|
||
|
import okhttp3.Callback;
|
||
|
import okhttp3.CertificatePinner;
|
||
|
import okhttp3.Dispatcher;
|
||
|
import okhttp3.EventListener;
|
||
|
import okhttp3.HttpUrl;
|
||
|
import okhttp3.OkHttpClient;
|
||
|
import okhttp3.Request;
|
||
|
import okhttp3.Response;
|
||
|
import okhttp3.internal.Util;
|
||
|
import okhttp3.internal.cache.CacheInterceptor;
|
||
|
import okhttp3.internal.http.BridgeInterceptor;
|
||
|
import okhttp3.internal.http.CallServerInterceptor;
|
||
|
import okhttp3.internal.http.RealInterceptorChain;
|
||
|
import okhttp3.internal.http.RetryAndFollowUpInterceptor;
|
||
|
import okhttp3.internal.platform.Platform;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class RealCall implements Call {
|
||
|
private Object callStackTrace;
|
||
|
private volatile boolean canceled;
|
||
|
private final OkHttpClient client;
|
||
|
private RealConnection connection;
|
||
|
private final RealConnectionPool connectionPool;
|
||
|
private volatile RealConnection connectionToCancel;
|
||
|
private final EventListener eventListener;
|
||
|
private volatile Exchange exchange;
|
||
|
private ExchangeFinder exchangeFinder;
|
||
|
private final AtomicBoolean executed;
|
||
|
private boolean expectMoreExchanges;
|
||
|
private final boolean forWebSocket;
|
||
|
private Exchange interceptorScopedExchange;
|
||
|
private final Request originalRequest;
|
||
|
private boolean requestBodyOpen;
|
||
|
private boolean responseBodyOpen;
|
||
|
private final RealCall$timeout$1 timeout;
|
||
|
private boolean timeoutEarlyExit;
|
||
|
|
||
|
/* JADX WARN: Type inference failed for: r2v3, types: [o.giB, okhttp3.internal.connection.RealCall$timeout$1] */
|
||
|
public RealCall(OkHttpClient okHttpClient, Request request, boolean z) {
|
||
|
C14957gcv.e(okHttpClient, "");
|
||
|
C14957gcv.e(request, "");
|
||
|
this.client = okHttpClient;
|
||
|
this.originalRequest = request;
|
||
|
this.forWebSocket = z;
|
||
|
this.connectionPool = okHttpClient.connectionPool().getDelegate$okhttp();
|
||
|
this.eventListener = okHttpClient.eventListenerFactory().create(this);
|
||
|
?? r2 = new ghX(this) { // from class: okhttp3.internal.connection.RealCall$timeout$1
|
||
|
final RealCall this$0;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
{
|
||
|
this.this$0 = this;
|
||
|
}
|
||
|
|
||
|
@Override // o.ghX
|
||
|
public final void timedOut() {
|
||
|
this.this$0.cancel();
|
||
|
}
|
||
|
};
|
||
|
r2.timeout(getClient().callTimeoutMillis(), TimeUnit.MILLISECONDS);
|
||
|
this.timeout = r2;
|
||
|
this.executed = new AtomicBoolean();
|
||
|
this.expectMoreExchanges = true;
|
||
|
}
|
||
|
|
||
|
@Override // okhttp3.Call
|
||
|
public final ghX timeout() {
|
||
|
return this.timeout;
|
||
|
}
|
||
|
|
||
|
@Override // okhttp3.Call
|
||
|
public final RealCall clone() {
|
||
|
return new RealCall(this.client, this.originalRequest, this.forWebSocket);
|
||
|
}
|
||
|
|
||
|
@Override // okhttp3.Call
|
||
|
public final void cancel() {
|
||
|
if (this.canceled) {
|
||
|
return;
|
||
|
}
|
||
|
this.canceled = true;
|
||
|
Exchange exchange = this.exchange;
|
||
|
if (exchange != null) {
|
||
|
exchange.cancel();
|
||
|
}
|
||
|
RealConnection realConnection = this.connectionToCancel;
|
||
|
if (realConnection != null) {
|
||
|
realConnection.cancel();
|
||
|
}
|
||
|
this.eventListener.canceled(this);
|
||
|
}
|
||
|
|
||
|
@Override // okhttp3.Call
|
||
|
public final Response execute() {
|
||
|
if (!this.executed.compareAndSet(false, true)) {
|
||
|
throw new IllegalStateException("Already Executed".toString());
|
||
|
}
|
||
|
enter();
|
||
|
callStart();
|
||
|
try {
|
||
|
this.client.dispatcher().executed$okhttp(this);
|
||
|
return getResponseWithInterceptorChain$okhttp();
|
||
|
} finally {
|
||
|
this.client.dispatcher().finished$okhttp(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // okhttp3.Call
|
||
|
public final void enqueue(Callback callback) {
|
||
|
C14957gcv.e(callback, "");
|
||
|
if (!this.executed.compareAndSet(false, true)) {
|
||
|
throw new IllegalStateException("Already Executed".toString());
|
||
|
}
|
||
|
callStart();
|
||
|
this.client.dispatcher().enqueue$okhttp(new AsyncCall(this, callback));
|
||
|
}
|
||
|
|
||
|
@Override // okhttp3.Call
|
||
|
public final boolean isExecuted() {
|
||
|
return this.executed.get();
|
||
|
}
|
||
|
|
||
|
private final void callStart() {
|
||
|
this.callStackTrace = Platform.Companion.get().getStackTraceForCloseable("response.body().close()");
|
||
|
this.eventListener.callStart(this);
|
||
|
}
|
||
|
|
||
|
public final Response getResponseWithInterceptorChain$okhttp() throws IOException {
|
||
|
ArrayList arrayList = new ArrayList();
|
||
|
ArrayList arrayList2 = arrayList;
|
||
|
C14881gav.d(arrayList2, this.client.interceptors());
|
||
|
arrayList2.add(new RetryAndFollowUpInterceptor(this.client));
|
||
|
arrayList2.add(new BridgeInterceptor(this.client.cookieJar()));
|
||
|
arrayList2.add(new CacheInterceptor(this.client.cache()));
|
||
|
arrayList2.add(ConnectInterceptor.INSTANCE);
|
||
|
if (!this.forWebSocket) {
|
||
|
C14881gav.d(arrayList2, this.client.networkInterceptors());
|
||
|
}
|
||
|
arrayList2.add(new CallServerInterceptor(this.forWebSocket));
|
||
|
try {
|
||
|
try {
|
||
|
Response proceed = new RealInterceptorChain(this, arrayList, 0, null, this.originalRequest, this.client.connectTimeoutMillis(), this.client.readTimeoutMillis(), this.client.writeTimeoutMillis()).proceed(this.originalRequest);
|
||
|
if (isCanceled()) {
|
||
|
Util.closeQuietly(proceed);
|
||
|
throw new IOException("Canceled");
|
||
|
}
|
||
|
noMoreExchanges$okhttp(null);
|
||
|
return proceed;
|
||
|
} catch (IOException e) {
|
||
|
IOException noMoreExchanges$okhttp = noMoreExchanges$okhttp(e);
|
||
|
if (noMoreExchanges$okhttp == null) {
|
||
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Throwable");
|
||
|
}
|
||
|
throw noMoreExchanges$okhttp;
|
||
|
}
|
||
|
} catch (Throwable th) {
|
||
|
if (0 == 0) {
|
||
|
noMoreExchanges$okhttp(null);
|
||
|
}
|
||
|
throw th;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void enterNetworkInterceptorExchange(Request request, boolean z) {
|
||
|
C14957gcv.e(request, "");
|
||
|
if (this.interceptorScopedExchange != null) {
|
||
|
throw new IllegalStateException("Check failed.".toString());
|
||
|
}
|
||
|
synchronized (this) {
|
||
|
if (!(!this.responseBodyOpen)) {
|
||
|
throw new IllegalStateException("cannot make a new request because the previous response is still open: please call response.close()".toString());
|
||
|
}
|
||
|
if (!(!this.requestBodyOpen)) {
|
||
|
throw new IllegalStateException("Check failed.".toString());
|
||
|
}
|
||
|
C14866gag c14866gag = C14866gag.c;
|
||
|
}
|
||
|
if (z) {
|
||
|
this.exchangeFinder = new ExchangeFinder(this.connectionPool, createAddress(request.url()), this, this.eventListener);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final Exchange initExchange$okhttp(RealInterceptorChain realInterceptorChain) {
|
||
|
C14957gcv.e(realInterceptorChain, "");
|
||
|
synchronized (this) {
|
||
|
if (!this.expectMoreExchanges) {
|
||
|
throw new IllegalStateException("released".toString());
|
||
|
}
|
||
|
if (!(!this.responseBodyOpen)) {
|
||
|
throw new IllegalStateException("Check failed.".toString());
|
||
|
}
|
||
|
if (!(!this.requestBodyOpen)) {
|
||
|
throw new IllegalStateException("Check failed.".toString());
|
||
|
}
|
||
|
C14866gag c14866gag = C14866gag.c;
|
||
|
}
|
||
|
ExchangeFinder exchangeFinder = this.exchangeFinder;
|
||
|
C14957gcv.e(exchangeFinder);
|
||
|
Exchange exchange = new Exchange(this, this.eventListener, exchangeFinder, exchangeFinder.find(this.client, realInterceptorChain));
|
||
|
this.interceptorScopedExchange = exchange;
|
||
|
this.exchange = exchange;
|
||
|
synchronized (this) {
|
||
|
this.requestBodyOpen = true;
|
||
|
this.responseBodyOpen = true;
|
||
|
C14866gag c14866gag2 = C14866gag.c;
|
||
|
}
|
||
|
if (this.canceled) {
|
||
|
throw new IOException("Canceled");
|
||
|
}
|
||
|
return exchange;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Removed duplicated region for block: B:12:0x0021 A[Catch: all -> 0x0017, TryCatch #0 {all -> 0x0017, blocks: (B:44:0x0012, B:12:0x0021, B:14:0x0025, B:15:0x0027, B:17:0x002c, B:21:0x0035, B:23:0x0039, B:27:0x0042, B:9:0x001b), top: B:43:0x0012 }] */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:14:0x0025 A[Catch: all -> 0x0017, TryCatch #0 {all -> 0x0017, blocks: (B:44:0x0012, B:12:0x0021, B:14:0x0025, B:15:0x0027, B:17:0x002c, B:21:0x0035, B:23:0x0039, B:27:0x0042, B:9:0x001b), top: B:43:0x0012 }] */
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public final <E extends java.io.IOException> E messageDone$okhttp(okhttp3.internal.connection.Exchange r2, boolean r3, boolean r4, E r5) {
|
||
|
/*
|
||
|
r1 = this;
|
||
|
java.lang.String r0 = ""
|
||
|
o.C14957gcv.e(r2, r0)
|
||
|
okhttp3.internal.connection.Exchange r0 = r1.exchange
|
||
|
boolean r2 = o.C14957gcv.b(r2, r0)
|
||
|
if (r2 != 0) goto Le
|
||
|
return r5
|
||
|
Le:
|
||
|
monitor-enter(r1)
|
||
|
r2 = 0
|
||
|
if (r3 == 0) goto L19
|
||
|
boolean r0 = r1.requestBodyOpen // Catch: java.lang.Throwable -> L17
|
||
|
if (r0 != 0) goto L1f
|
||
|
goto L19
|
||
|
L17:
|
||
|
r2 = move-exception
|
||
|
goto L59
|
||
|
L19:
|
||
|
if (r4 == 0) goto L41
|
||
|
boolean r0 = r1.responseBodyOpen // Catch: java.lang.Throwable -> L17
|
||
|
if (r0 == 0) goto L41
|
||
|
L1f:
|
||
|
if (r3 == 0) goto L23
|
||
|
r1.requestBodyOpen = r2 // Catch: java.lang.Throwable -> L17
|
||
|
L23:
|
||
|
if (r4 == 0) goto L27
|
||
|
r1.responseBodyOpen = r2 // Catch: java.lang.Throwable -> L17
|
||
|
L27:
|
||
|
boolean r3 = r1.requestBodyOpen // Catch: java.lang.Throwable -> L17
|
||
|
r4 = 1
|
||
|
if (r3 != 0) goto L32
|
||
|
boolean r0 = r1.responseBodyOpen // Catch: java.lang.Throwable -> L17
|
||
|
if (r0 != 0) goto L32
|
||
|
r0 = r4
|
||
|
goto L33
|
||
|
L32:
|
||
|
r0 = r2
|
||
|
L33:
|
||
|
if (r3 != 0) goto L3e
|
||
|
boolean r3 = r1.responseBodyOpen // Catch: java.lang.Throwable -> L17
|
||
|
if (r3 != 0) goto L3e
|
||
|
boolean r3 = r1.expectMoreExchanges // Catch: java.lang.Throwable -> L17
|
||
|
if (r3 != 0) goto L3e
|
||
|
r2 = r4
|
||
|
L3e:
|
||
|
r3 = r2
|
||
|
r2 = r0
|
||
|
goto L42
|
||
|
L41:
|
||
|
r3 = r2
|
||
|
L42:
|
||
|
o.gag r4 = o.C14866gag.c // Catch: java.lang.Throwable -> L17
|
||
|
monitor-exit(r1)
|
||
|
if (r2 == 0) goto L51
|
||
|
r2 = 0
|
||
|
r1.exchange = r2
|
||
|
okhttp3.internal.connection.RealConnection r2 = r1.connection
|
||
|
if (r2 == 0) goto L51
|
||
|
r2.incrementSuccessCount$okhttp()
|
||
|
L51:
|
||
|
if (r3 == 0) goto L58
|
||
|
java.io.IOException r2 = r1.callDone(r5)
|
||
|
return r2
|
||
|
L58:
|
||
|
return r5
|
||
|
L59:
|
||
|
monitor-exit(r1)
|
||
|
throw r2
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.connection.RealCall.messageDone$okhttp(okhttp3.internal.connection.Exchange, boolean, boolean, java.io.IOException):java.io.IOException");
|
||
|
}
|
||
|
|
||
|
public final IOException noMoreExchanges$okhttp(IOException iOException) {
|
||
|
boolean z;
|
||
|
synchronized (this) {
|
||
|
z = false;
|
||
|
if (this.expectMoreExchanges) {
|
||
|
this.expectMoreExchanges = false;
|
||
|
if (!this.requestBodyOpen && !this.responseBodyOpen) {
|
||
|
z = true;
|
||
|
}
|
||
|
}
|
||
|
C14866gag c14866gag = C14866gag.c;
|
||
|
}
|
||
|
return z ? callDone(iOException) : iOException;
|
||
|
}
|
||
|
|
||
|
public final Socket releaseConnectionNoEvents$okhttp() {
|
||
|
RealConnection realConnection = this.connection;
|
||
|
C14957gcv.e(realConnection);
|
||
|
if (!Util.assertionsEnabled || Thread.holdsLock(realConnection)) {
|
||
|
List<Reference<RealCall>> calls = realConnection.getCalls();
|
||
|
Iterator<Reference<RealCall>> it = calls.iterator();
|
||
|
int i = 0;
|
||
|
while (true) {
|
||
|
if (!it.hasNext()) {
|
||
|
i = -1;
|
||
|
break;
|
||
|
}
|
||
|
if (C14957gcv.b(it.next().get(), this)) {
|
||
|
break;
|
||
|
}
|
||
|
i++;
|
||
|
}
|
||
|
if (i == -1) {
|
||
|
throw new IllegalStateException("Check failed.".toString());
|
||
|
}
|
||
|
calls.remove(i);
|
||
|
this.connection = null;
|
||
|
if (calls.isEmpty()) {
|
||
|
realConnection.setIdleAtNs$okhttp(System.nanoTime());
|
||
|
if (this.connectionPool.connectionBecameIdle(realConnection)) {
|
||
|
return realConnection.socket();
|
||
|
}
|
||
|
}
|
||
|
return null;
|
||
|
}
|
||
|
StringBuilder sb = new StringBuilder("Thread ");
|
||
|
sb.append((Object) Thread.currentThread().getName());
|
||
|
sb.append(" MUST hold lock on ");
|
||
|
sb.append(realConnection);
|
||
|
throw new AssertionError(sb.toString());
|
||
|
}
|
||
|
|
||
|
private final <E extends IOException> E timeoutExit(E e) {
|
||
|
if (this.timeoutEarlyExit || !exit()) {
|
||
|
return e;
|
||
|
}
|
||
|
InterruptedIOException interruptedIOException = new InterruptedIOException("timeout");
|
||
|
if (e != null) {
|
||
|
interruptedIOException.initCause(e);
|
||
|
}
|
||
|
return interruptedIOException;
|
||
|
}
|
||
|
|
||
|
public final void timeoutEarlyExit() {
|
||
|
if (!(!this.timeoutEarlyExit)) {
|
||
|
throw new IllegalStateException("Check failed.".toString());
|
||
|
}
|
||
|
this.timeoutEarlyExit = true;
|
||
|
exit();
|
||
|
}
|
||
|
|
||
|
public final void exitNetworkInterceptorExchange$okhttp(boolean z) {
|
||
|
Exchange exchange;
|
||
|
synchronized (this) {
|
||
|
if (!this.expectMoreExchanges) {
|
||
|
throw new IllegalStateException("released".toString());
|
||
|
}
|
||
|
C14866gag c14866gag = C14866gag.c;
|
||
|
}
|
||
|
if (z && (exchange = this.exchange) != null) {
|
||
|
exchange.detachWithViolence();
|
||
|
}
|
||
|
this.interceptorScopedExchange = null;
|
||
|
}
|
||
|
|
||
|
private final Address createAddress(HttpUrl httpUrl) {
|
||
|
SSLSocketFactory sSLSocketFactory;
|
||
|
HostnameVerifier hostnameVerifier;
|
||
|
CertificatePinner certificatePinner;
|
||
|
if (httpUrl.isHttps()) {
|
||
|
sSLSocketFactory = this.client.sslSocketFactory();
|
||
|
hostnameVerifier = this.client.hostnameVerifier();
|
||
|
certificatePinner = this.client.certificatePinner();
|
||
|
} else {
|
||
|
sSLSocketFactory = null;
|
||
|
hostnameVerifier = null;
|
||
|
certificatePinner = null;
|
||
|
}
|
||
|
return new Address(httpUrl.host(), httpUrl.port(), this.client.dns(), this.client.socketFactory(), sSLSocketFactory, hostnameVerifier, certificatePinner, this.client.proxyAuthenticator(), this.client.proxy(), this.client.protocols(), this.client.connectionSpecs(), this.client.proxySelector());
|
||
|
}
|
||
|
|
||
|
public final boolean retryAfterFailure() {
|
||
|
ExchangeFinder exchangeFinder = this.exchangeFinder;
|
||
|
C14957gcv.e(exchangeFinder);
|
||
|
return exchangeFinder.retryAfterFailure();
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: private */
|
||
|
public final String toLoggableString() {
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(isCanceled() ? "canceled " : "");
|
||
|
sb.append(this.forWebSocket ? "web socket" : "call");
|
||
|
sb.append(" to ");
|
||
|
sb.append(redactedUrl$okhttp());
|
||
|
return sb.toString();
|
||
|
}
|
||
|
|
||
|
public final String redactedUrl$okhttp() {
|
||
|
return this.originalRequest.url().redact();
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class AsyncCall implements Runnable {
|
||
|
private volatile AtomicInteger callsPerHost;
|
||
|
private final Callback responseCallback;
|
||
|
final RealCall this$0;
|
||
|
|
||
|
public AsyncCall(RealCall realCall, Callback callback) {
|
||
|
C14957gcv.e(realCall, "");
|
||
|
C14957gcv.e(callback, "");
|
||
|
this.this$0 = realCall;
|
||
|
this.responseCallback = callback;
|
||
|
this.callsPerHost = new AtomicInteger(0);
|
||
|
}
|
||
|
|
||
|
public final void reuseCallsPerHostFrom(AsyncCall asyncCall) {
|
||
|
C14957gcv.e(asyncCall, "");
|
||
|
this.callsPerHost = asyncCall.callsPerHost;
|
||
|
}
|
||
|
|
||
|
public final String getHost() {
|
||
|
return this.this$0.getOriginalRequest().url().host();
|
||
|
}
|
||
|
|
||
|
public final Request getRequest() {
|
||
|
return this.this$0.getOriginalRequest();
|
||
|
}
|
||
|
|
||
|
public final void executeOn(ExecutorService executorService) {
|
||
|
C14957gcv.e(executorService, "");
|
||
|
Dispatcher dispatcher = this.this$0.getClient().dispatcher();
|
||
|
if (!Util.assertionsEnabled || !Thread.holdsLock(dispatcher)) {
|
||
|
try {
|
||
|
try {
|
||
|
executorService.execute(this);
|
||
|
return;
|
||
|
} catch (RejectedExecutionException e) {
|
||
|
InterruptedIOException interruptedIOException = new InterruptedIOException("executor rejected");
|
||
|
interruptedIOException.initCause(e);
|
||
|
this.this$0.noMoreExchanges$okhttp(interruptedIOException);
|
||
|
this.responseCallback.onFailure(this.this$0, interruptedIOException);
|
||
|
this.this$0.getClient().dispatcher().finished$okhttp(this);
|
||
|
return;
|
||
|
}
|
||
|
} catch (Throwable th) {
|
||
|
this.this$0.getClient().dispatcher().finished$okhttp(this);
|
||
|
throw th;
|
||
|
}
|
||
|
}
|
||
|
StringBuilder sb = new StringBuilder("Thread ");
|
||
|
sb.append((Object) Thread.currentThread().getName());
|
||
|
sb.append(" MUST NOT hold lock on ");
|
||
|
sb.append(dispatcher);
|
||
|
throw new AssertionError(sb.toString());
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
OkHttpClient client;
|
||
|
String c = C14957gcv.c("OkHttp ", (Object) this.this$0.redactedUrl$okhttp());
|
||
|
RealCall realCall = this.this$0;
|
||
|
Thread currentThread = Thread.currentThread();
|
||
|
String name = currentThread.getName();
|
||
|
currentThread.setName(c);
|
||
|
try {
|
||
|
realCall.timeout.enter();
|
||
|
boolean z = false;
|
||
|
try {
|
||
|
try {
|
||
|
} catch (Throwable th) {
|
||
|
realCall.getClient().dispatcher().finished$okhttp(this);
|
||
|
throw th;
|
||
|
}
|
||
|
} catch (IOException e) {
|
||
|
e = e;
|
||
|
} catch (Throwable th2) {
|
||
|
th = th2;
|
||
|
}
|
||
|
try {
|
||
|
this.responseCallback.onResponse(realCall, realCall.getResponseWithInterceptorChain$okhttp());
|
||
|
client = realCall.getClient();
|
||
|
} catch (IOException e2) {
|
||
|
e = e2;
|
||
|
z = true;
|
||
|
if (z) {
|
||
|
Platform.Companion.get().log(C14957gcv.c("Callback failure for ", (Object) realCall.toLoggableString()), 4, e);
|
||
|
} else {
|
||
|
this.responseCallback.onFailure(realCall, e);
|
||
|
}
|
||
|
client = realCall.getClient();
|
||
|
client.dispatcher().finished$okhttp(this);
|
||
|
} catch (Throwable th3) {
|
||
|
th = th3;
|
||
|
z = true;
|
||
|
realCall.cancel();
|
||
|
if (!z) {
|
||
|
IOException iOException = new IOException(C14957gcv.c("canceled due to ", th));
|
||
|
IOException iOException2 = iOException;
|
||
|
C14957gcv.e(iOException2, "");
|
||
|
C14957gcv.e(th, "");
|
||
|
if (iOException2 != th) {
|
||
|
C14887gbC.c.d(iOException2, th);
|
||
|
}
|
||
|
this.responseCallback.onFailure(realCall, iOException);
|
||
|
}
|
||
|
throw th;
|
||
|
}
|
||
|
client.dispatcher().finished$okhttp(this);
|
||
|
} finally {
|
||
|
currentThread.setName(name);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final AtomicInteger getCallsPerHost() {
|
||
|
return this.callsPerHost;
|
||
|
}
|
||
|
|
||
|
public final RealCall getCall() {
|
||
|
return this.this$0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public static final class CallReference extends WeakReference<RealCall> {
|
||
|
private final Object callStackTrace;
|
||
|
|
||
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
||
|
public CallReference(RealCall realCall, Object obj) {
|
||
|
super(realCall);
|
||
|
C14957gcv.e(realCall, "");
|
||
|
this.callStackTrace = obj;
|
||
|
}
|
||
|
|
||
|
public final Object getCallStackTrace() {
|
||
|
return this.callStackTrace;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final void acquireConnectionNoEvents(RealConnection realConnection) {
|
||
|
C14957gcv.e(realConnection, "");
|
||
|
if (!Util.assertionsEnabled || Thread.holdsLock(realConnection)) {
|
||
|
if (this.connection != null) {
|
||
|
throw new IllegalStateException("Check failed.".toString());
|
||
|
}
|
||
|
this.connection = realConnection;
|
||
|
realConnection.getCalls().add(new CallReference(this, this.callStackTrace));
|
||
|
return;
|
||
|
}
|
||
|
StringBuilder sb = new StringBuilder("Thread ");
|
||
|
sb.append((Object) Thread.currentThread().getName());
|
||
|
sb.append(" MUST hold lock on ");
|
||
|
sb.append(realConnection);
|
||
|
throw new AssertionError(sb.toString());
|
||
|
}
|
||
|
|
||
|
private final <E extends IOException> E callDone(E e) {
|
||
|
Socket releaseConnectionNoEvents$okhttp;
|
||
|
if (!Util.assertionsEnabled || !Thread.holdsLock(this)) {
|
||
|
RealConnection realConnection = this.connection;
|
||
|
if (realConnection != null) {
|
||
|
if (!Util.assertionsEnabled || !Thread.holdsLock(realConnection)) {
|
||
|
synchronized (realConnection) {
|
||
|
releaseConnectionNoEvents$okhttp = releaseConnectionNoEvents$okhttp();
|
||
|
}
|
||
|
if (this.connection == null) {
|
||
|
if (releaseConnectionNoEvents$okhttp != null) {
|
||
|
Util.closeQuietly(releaseConnectionNoEvents$okhttp);
|
||
|
}
|
||
|
this.eventListener.connectionReleased(this, realConnection);
|
||
|
} else if (releaseConnectionNoEvents$okhttp != null) {
|
||
|
throw new IllegalStateException("Check failed.".toString());
|
||
|
}
|
||
|
} else {
|
||
|
StringBuilder sb = new StringBuilder("Thread ");
|
||
|
sb.append((Object) Thread.currentThread().getName());
|
||
|
sb.append(" MUST NOT hold lock on ");
|
||
|
sb.append(realConnection);
|
||
|
throw new AssertionError(sb.toString());
|
||
|
}
|
||
|
}
|
||
|
E e2 = (E) timeoutExit(e);
|
||
|
if (e != null) {
|
||
|
C14957gcv.e(e2);
|
||
|
this.eventListener.callFailed(this, e2);
|
||
|
} else {
|
||
|
this.eventListener.callEnd(this);
|
||
|
}
|
||
|
return e2;
|
||
|
}
|
||
|
StringBuilder sb2 = new StringBuilder("Thread ");
|
||
|
sb2.append((Object) Thread.currentThread().getName());
|
||
|
sb2.append(" MUST NOT hold lock on ");
|
||
|
sb2.append(this);
|
||
|
throw new AssertionError(sb2.toString());
|
||
|
}
|
||
|
|
||
|
public final void setConnectionToCancel(RealConnection realConnection) {
|
||
|
this.connectionToCancel = realConnection;
|
||
|
}
|
||
|
|
||
|
@Override // okhttp3.Call
|
||
|
public final Request request() {
|
||
|
return this.originalRequest;
|
||
|
}
|
||
|
|
||
|
@Override // okhttp3.Call
|
||
|
public final boolean isCanceled() {
|
||
|
return this.canceled;
|
||
|
}
|
||
|
|
||
|
public final Request getOriginalRequest() {
|
||
|
return this.originalRequest;
|
||
|
}
|
||
|
|
||
|
public final Exchange getInterceptorScopedExchange$okhttp() {
|
||
|
return this.interceptorScopedExchange;
|
||
|
}
|
||
|
|
||
|
public final boolean getForWebSocket() {
|
||
|
return this.forWebSocket;
|
||
|
}
|
||
|
|
||
|
public final EventListener getEventListener$okhttp() {
|
||
|
return this.eventListener;
|
||
|
}
|
||
|
|
||
|
public final RealConnection getConnectionToCancel() {
|
||
|
return this.connectionToCancel;
|
||
|
}
|
||
|
|
||
|
public final RealConnection getConnection() {
|
||
|
return this.connection;
|
||
|
}
|
||
|
|
||
|
public final OkHttpClient getClient() {
|
||
|
return this.client;
|
||
|
}
|
||
|
}
|