package o; import io.reactivex.rxjava3.exceptions.CompositeException; import java.util.concurrent.atomic.AtomicInteger; /* renamed from: o.fXa, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C13327fXa extends fUX { private long a; private InterfaceC13193fTg d; public C13327fXa(AbstractC13163fSk abstractC13163fSk, long j, InterfaceC13193fTg interfaceC13193fTg) { super(abstractC13163fSk); this.d = interfaceC13193fTg; this.a = j; } @Override // o.AbstractC13163fSk public final void subscribeActual(InterfaceC13174fSv interfaceC13174fSv) { C13197fTk c13197fTk = new C13197fTk(); interfaceC13174fSv.onSubscribe(c13197fTk); new LWm(interfaceC13174fSv, this.a, this.d, c13197fTk, this.c).b(); } /* renamed from: o.fXa$LWm */ /* loaded from: classes6.dex */ static final class LWm extends AtomicInteger implements InterfaceC13174fSv { private InterfaceC13193fTg a; private C13197fTk b; private InterfaceC13174fSv c; private long d; private InterfaceC13169fSq e; LWm(InterfaceC13174fSv interfaceC13174fSv, long j, InterfaceC13193fTg interfaceC13193fTg, C13197fTk c13197fTk, InterfaceC13169fSq interfaceC13169fSq) { this.c = interfaceC13174fSv; this.b = c13197fTk; this.e = interfaceC13169fSq; this.a = interfaceC13193fTg; this.d = j; } @Override // o.InterfaceC13174fSv public final void onNext(T t) { this.c.onNext(t); } @Override // o.InterfaceC13174fSv public final void onError(Throwable th) { long j = this.d; if (j != Long.MAX_VALUE) { this.d = j - 1; } if (j == 0) { this.c.onError(th); return; } try { if (!this.a.a(th)) { this.c.onError(th); } else { b(); } } catch (Throwable th2) { C13147fSI.c(th2); this.c.onError(new CompositeException(th, th2)); } } @Override // o.InterfaceC13174fSv public final void onComplete() { this.c.onComplete(); } final void b() { if (getAndIncrement() == 0) { int i = 1; while (!this.b.isDisposed()) { this.e.subscribe(this); i = addAndGet(-i); if (i == 0) { return; } } } } @Override // o.InterfaceC13174fSv public final void onSubscribe(fSJ fsj) { EnumC13192fTf.c(this.b, fsj); } } }