package n9; import com.google.android.gms.ads.RequestConfiguration; import java.io.IOException; import java.io.InterruptedIOException; import java.util.concurrent.ExecutorService; import java.util.concurrent.RejectedExecutionException; import java.util.concurrent.atomic.AtomicInteger; /* loaded from: classes2.dex */ final class d0 implements g { /* renamed from: a, reason: collision with root package name */ final b0 f12314a; /* renamed from: b, reason: collision with root package name */ private q9.k f12315b; /* renamed from: c, reason: collision with root package name */ final e0 f12316c; /* renamed from: d, reason: collision with root package name */ final boolean f12317d; /* renamed from: e, reason: collision with root package name */ private boolean f12318e; final class a extends o9.b { /* renamed from: b, reason: collision with root package name */ private final h f12319b; /* renamed from: c, reason: collision with root package name */ private volatile AtomicInteger f12320c; a(h hVar) { super("OkHttp %s", d0.this.g()); this.f12320c = new AtomicInteger(0); this.f12319b = hVar; } @Override // o9.b protected void k() { Throwable th; boolean z10; IOException e10; d0.this.f12315b.p(); try { try { z10 = true; } catch (IOException e11) { e10 = e11; z10 = false; } catch (Throwable th2) { th = th2; z10 = false; } try { this.f12319b.a(d0.this, d0.this.d()); } catch (IOException e12) { e10 = e12; if (z10) { u9.j.l().s(4, "Callback failure for " + d0.this.h(), e10); } else { this.f12319b.b(d0.this, e10); } d0.this.f12314a.j().f(this); } catch (Throwable th3) { th = th3; d0.this.cancel(); if (!z10) { IOException iOException = new IOException("canceled due to " + th); iOException.addSuppressed(th); this.f12319b.b(d0.this, iOException); } throw th; } d0.this.f12314a.j().f(this); } catch (Throwable th4) { d0.this.f12314a.j().f(this); throw th4; } } AtomicInteger l() { return this.f12320c; } void m(ExecutorService executorService) { try { try { executorService.execute(this); } catch (RejectedExecutionException e10) { InterruptedIOException interruptedIOException = new InterruptedIOException("executor rejected"); interruptedIOException.initCause(e10); d0.this.f12315b.l(interruptedIOException); this.f12319b.b(d0.this, interruptedIOException); d0.this.f12314a.j().f(this); } } catch (Throwable th) { d0.this.f12314a.j().f(this); throw th; } } d0 n() { return d0.this; } String o() { return d0.this.f12316c.h().l(); } void p(a aVar) { this.f12320c = aVar.f12320c; } } private d0(b0 b0Var, e0 e0Var, boolean z10) { this.f12314a = b0Var; this.f12316c = e0Var; this.f12317d = z10; } static d0 f(b0 b0Var, e0 e0Var, boolean z10) { d0 d0Var = new d0(b0Var, e0Var, z10); d0Var.f12315b = new q9.k(b0Var, d0Var); return d0Var; } @Override // n9.g public void G(h hVar) { synchronized (this) { if (this.f12318e) { throw new IllegalStateException("Already Executed"); } this.f12318e = true; } this.f12315b.b(); this.f12314a.j().a(new a(hVar)); } /* renamed from: b, reason: merged with bridge method [inline-methods] */ public d0 clone() { return f(this.f12314a, this.f12316c, this.f12317d); } @Override // n9.g public g0 c() { synchronized (this) { if (this.f12318e) { throw new IllegalStateException("Already Executed"); } this.f12318e = true; } this.f12315b.p(); this.f12315b.b(); try { this.f12314a.j().b(this); return d(); } finally { this.f12314a.j().g(this); } } @Override // n9.g public void cancel() { this.f12315b.d(); } /* JADX WARN: Removed duplicated region for block: B:23:0x00a4 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ n9.g0 d() { /* r12 = this; java.util.ArrayList r1 = new java.util.ArrayList r1.() n9.b0 r0 = r12.f12314a java.util.List r0 = r0.p() r1.addAll(r0) r9.j r0 = new r9.j n9.b0 r2 = r12.f12314a r0.(r2) r1.add(r0) r9.a r0 = new r9.a n9.b0 r2 = r12.f12314a n9.p r2 = r2.i() r0.(r2) r1.add(r0) p9.a r0 = new p9.a n9.b0 r2 = r12.f12314a r2.q() r10 = 0 r0.(r10) r1.add(r0) q9.a r0 = new q9.a n9.b0 r2 = r12.f12314a r0.(r2) r1.add(r0) boolean r0 = r12.f12317d if (r0 != 0) goto L4b n9.b0 r0 = r12.f12314a java.util.List r0 = r0.r() r1.addAll(r0) L4b: r9.b r0 = new r9.b boolean r2 = r12.f12317d r0.(r2) r1.add(r0) r9.g r11 = new r9.g q9.k r2 = r12.f12315b r3 = 0 r4 = 0 n9.e0 r5 = r12.f12316c n9.b0 r0 = r12.f12314a int r7 = r0.f() n9.b0 r0 = r12.f12314a int r8 = r0.A() n9.b0 r0 = r12.f12314a int r9 = r0.E() r0 = r11 r6 = r12 r0.(r1, r2, r3, r4, r5, r6, r7, r8, r9) r0 = 0 n9.e0 r1 = r12.f12316c // Catch: java.lang.Throwable -> L94 java.io.IOException -> L96 n9.g0 r1 = r11.e(r1) // Catch: java.lang.Throwable -> L94 java.io.IOException -> L96 q9.k r2 = r12.f12315b // Catch: java.lang.Throwable -> L94 java.io.IOException -> L96 boolean r2 = r2.i() // Catch: java.lang.Throwable -> L94 java.io.IOException -> L96 if (r2 != 0) goto L89 q9.k r0 = r12.f12315b r0.l(r10) return r1 L89: o9.e.g(r1) // Catch: java.lang.Throwable -> L94 java.io.IOException -> L96 java.io.IOException r1 = new java.io.IOException // Catch: java.lang.Throwable -> L94 java.io.IOException -> L96 java.lang.String r2 = "Canceled" r1.(r2) // Catch: java.lang.Throwable -> L94 java.io.IOException -> L96 throw r1 // Catch: java.lang.Throwable -> L94 java.io.IOException -> L96 L94: r1 = move-exception goto La2 L96: r0 = move-exception r1 = 1 q9.k r2 = r12.f12315b // Catch: java.lang.Throwable -> L9f java.io.IOException r0 = r2.l(r0) // Catch: java.lang.Throwable -> L9f throw r0 // Catch: java.lang.Throwable -> L9f L9f: r0 = move-exception r1 = r0 r0 = 1 La2: if (r0 != 0) goto La9 q9.k r0 = r12.f12315b r0.l(r10) La9: throw r1 */ throw new UnsupportedOperationException("Method not decompiled: n9.d0.d():n9.g0"); } public boolean e() { return this.f12315b.i(); } String g() { return this.f12316c.h().B(); } String h() { StringBuilder sb = new StringBuilder(); sb.append(e() ? "canceled " : RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED); sb.append(this.f12317d ? "web socket" : "call"); sb.append(" to "); sb.append(g()); return sb.toString(); } }