package o;

import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.n00, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class RunnableC1917n00 implements Runnable {
    public final C0272Km l;
    public volatile AtomicInteger m = new AtomicInteger(0);
    public final /* synthetic */ C2202q00 n;

    public RunnableC1917n00(C2202q00 c2202q00, C0272Km c0272Km) {
        this.n = c2202q00;
        this.l = c0272Km;
    }

    @Override // java.lang.Runnable
    public final void run() {
        C2429sT c2429sT;
        String strConcat = "OkHttp ".concat(((ZF) this.n.m.m).f());
        C2202q00 c2202q00 = this.n;
        Thread threadCurrentThread = Thread.currentThread();
        String name = threadCurrentThread.getName();
        threadCurrentThread.setName(strConcat);
        try {
            c2202q00.f683o.h();
            boolean z = false;
            try {
                try {
                    try {
                        ((C2448sg) this.l.n).resumeWith(c2202q00.g());
                        c2429sT = c2202q00.l;
                    } catch (IOException e) {
                        e = e;
                        z = true;
                        if (z) {
                            ZW zw = ZW.a;
                            ZW zw2 = ZW.a;
                            String str = "Callback failure for " + C2202q00.a(c2202q00);
                            zw2.getClass();
                            ZW.i(str, 4, e);
                        } else {
                            C0272Km c0272Km = this.l;
                            if (!c2202q00.x) {
                                ((C2448sg) c0272Km.n).resumeWith(new H20(e));
                            }
                        }
                        c2429sT = c2202q00.l;
                        c2429sT.l.b(this);
                    } catch (Throwable th) {
                        th = th;
                        z = true;
                        c2202q00.d();
                        if (!z) {
                            IOException iOException = new IOException("canceled due to " + th);
                            C80.i(iOException, th);
                            C0272Km c0272Km2 = this.l;
                            if (!c2202q00.x) {
                                ((C2448sg) c0272Km2.n).resumeWith(new H20(iOException));
                            }
                        }
                        throw th;
                    }
                } catch (Throwable th2) {
                    c2202q00.l.l.b(this);
                    throw th2;
                }
            } catch (IOException e2) {
                e = e2;
            } catch (Throwable th3) {
                th = th3;
            }
            c2429sT.l.b(this);
        } finally {
            threadCurrentThread.setName(name);
        }
    }
}
