package okhttp3.repackaged; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import okhttp3.repackaged.Interceptor; import okhttp3.repackaged.internal.Internal; import okhttp3.repackaged.internal.NamedRunnable; import okhttp3.repackaged.internal.http.HttpEngine; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes6.dex */ public final class a implements Call { private boolean ait; volatile boolean aiu; Request aiv; HttpEngine aiw; private final OkHttpClient client; /* JADX INFO: Access modifiers changed from: protected */ public a(OkHttpClient okHttpClient, Request request) { this.client = okHttpClient; this.aiv = request; } @Override // okhttp3.repackaged.Call public final Response execute() throws IOException { synchronized (this) { if (this.ait) { throw new IllegalStateException("Already Executed"); } this.ait = true; } try { this.client.dispatcher().a(this); Response y = y(false); if (y != null) { return y; } throw new IOException("Canceled"); } finally { this.client.dispatcher().a((Call) this); } } final Object tag() { return this.aiv.tag(); } @Override // okhttp3.repackaged.Call public final void enqueue(Callback callback) { a(callback, false); } /* JADX INFO: Access modifiers changed from: package-private */ public final void a(Callback callback, boolean z) { synchronized (this) { if (this.ait) { throw new IllegalStateException("Already Executed"); } this.ait = true; } this.client.dispatcher().a(new b(callback, z)); } @Override // okhttp3.repackaged.Call public final void cancel() { this.aiu = true; HttpEngine httpEngine = this.aiw; if (httpEngine != null) { httpEngine.cancel(); } } @Override // okhttp3.repackaged.Call public final boolean isExecuted() { boolean z; synchronized (this) { z = this.ait; } return z; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes6.dex */ public final class b extends NamedRunnable { final a aiy; private final Callback aiz; private final boolean forWebSocket; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ private b(a aVar, Callback callback, boolean z) { super("OkHttp %s", aVar.aiv.url().toString()); this.aiy = aVar; this.aiz = callback; this.forWebSocket = z; } /* JADX INFO: Access modifiers changed from: package-private */ public final String host() { return this.aiy.aiv.url().host(); } final Request request() { return this.aiy.aiv; } final Object tag() { return this.aiy.aiv.tag(); } /* JADX INFO: Access modifiers changed from: package-private */ public final void cancel() { this.aiy.cancel(); } @Override // okhttp3.repackaged.internal.NamedRunnable public final void execute() { boolean z; Response y; try { try { y = this.aiy.y(this.forWebSocket); } catch (IOException e) { e = e; z = false; } try { if (this.aiy.aiu) { this.aiz.onFailure(this.aiy, new IOException("Canceled")); } else { this.aiz.onResponse(this.aiy, y); } } catch (IOException e2) { e = e2; z = true; if (z) { Logger logger = Internal.logger; Level level = Level.INFO; StringBuilder sb = new StringBuilder("Callback failure for "); sb.append(this.aiy.toLoggableString()); logger.log(level, sb.toString(), (Throwable) e); } else { this.aiz.onFailure(this.aiy, e); } } } finally { this.aiy.client.dispatcher().b(this); } } /* JADX INFO: Access modifiers changed from: package-private */ public final a us() { return this.aiy; } } /* JADX INFO: Access modifiers changed from: private */ public String toLoggableString() { String str = this.aiu ? "canceled call" : "call"; HttpUrl resolve = this.aiv.url().resolve("/..."); StringBuilder sb = new StringBuilder(); sb.append(str); sb.append(" to "); sb.append(resolve); return sb.toString(); } /* JADX INFO: Access modifiers changed from: private */ public Response y(boolean z) throws IOException { return new C0129a(this, 0, this.aiv, z).proceed(this.aiv); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: okhttp3.repackaged.a$a, reason: collision with other inner class name */ /* loaded from: classes6.dex */ public class C0129a implements Interceptor.Chain { private final Request aix; final a aiy; private final boolean forWebSocket; private final int index; @Override // okhttp3.repackaged.Interceptor.Chain public Connection connection() { return null; } C0129a(a aVar, int i, Request request, boolean z) { this.aiy = aVar; this.index = i; this.aix = request; this.forWebSocket = z; } @Override // okhttp3.repackaged.Interceptor.Chain public Response proceed(Request request) throws IOException { if (this.index < this.aiy.client.interceptors().size()) { C0129a c0129a = new C0129a(this.aiy, this.index + 1, request, this.forWebSocket); Interceptor interceptor = this.aiy.client.interceptors().get(this.index); Response intercept = interceptor.intercept(c0129a); if (intercept != null) { return intercept; } StringBuilder sb = new StringBuilder("application interceptor "); sb.append(interceptor); sb.append(" returned null"); throw new NullPointerException(sb.toString()); } return this.aiy.a(request, this.forWebSocket); } @Override // okhttp3.repackaged.Interceptor.Chain public Request request() { return this.aix; } } /* JADX WARN: Removed duplicated region for block: B:41:0x00e9 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ final okhttp3.repackaged.Response a(okhttp3.repackaged.Request r14, boolean r15) throws java.io.IOException { /* Method dump skipped, instructions count: 256 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: okhttp3.repackaged.a.a(okhttp3.repackaged.Request, boolean):okhttp3.repackaged.Response"); } @Override // okhttp3.repackaged.Call public final Request request() { return this.aiv; } @Override // okhttp3.repackaged.Call public final boolean isCanceled() { return this.aiu; } }