what-the-bank/sources/o/C13350fXx.java

160 lines
5.1 KiB
Java

package o;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
/* renamed from: o.fXx, reason: case insensitive filesystem */
/* loaded from: classes6.dex */
public final class C13350fXx<T> extends fUX<T, T> {
private boolean a;
private long b;
private int d;
private AbstractC13173fSu e;
private long f;
private TimeUnit j;
public C13350fXx(InterfaceC13169fSq<T> interfaceC13169fSq, long j, long j2, TimeUnit timeUnit, AbstractC13173fSu abstractC13173fSu, int i, boolean z) {
super(interfaceC13169fSq);
this.b = j;
this.f = j2;
this.j = timeUnit;
this.e = abstractC13173fSu;
this.d = i;
this.a = z;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
this.c.subscribe(new HBt(interfaceC13174fSv, this.b, this.f, this.j, this.e, this.d, this.a));
}
/* renamed from: o.fXx$HBt */
/* loaded from: classes6.dex */
static final class HBt<T> extends AtomicBoolean implements InterfaceC13174fSv<T>, fSJ {
private Throwable a;
private boolean b;
private long c;
private InterfaceC13174fSv<? super T> d;
private volatile boolean e;
private fSJ f;
private C13416fZs<Object> g;
private AbstractC13173fSu h;
private TimeUnit i;
private long j;
HBt(InterfaceC13174fSv<? super T> interfaceC13174fSv, long j, long j2, TimeUnit timeUnit, AbstractC13173fSu abstractC13173fSu, int i, boolean z) {
this.d = interfaceC13174fSv;
this.c = j;
this.j = j2;
this.i = timeUnit;
this.h = abstractC13173fSu;
this.g = new C13416fZs<>(i);
this.b = z;
}
@Override // o.InterfaceC13174fSv
public final void onSubscribe(fSJ fsj) {
if (EnumC13192fTf.d(this.f, fsj)) {
this.f = fsj;
this.d.onSubscribe(this);
}
}
@Override // o.InterfaceC13174fSv
public final void onNext(T t) {
long j;
long j2;
C13416fZs<Object> c13416fZs = this.g;
long b = AbstractC13173fSu.b(this.i);
long j3 = this.j;
long j4 = this.c;
boolean z = j4 == Long.MAX_VALUE;
c13416fZs.e(Long.valueOf(b), t);
while (c13416fZs.b.get() != c13416fZs.e.get()) {
if (((Long) c13416fZs.a()).longValue() > b - j3) {
if (z) {
return;
}
long j5 = c13416fZs.e.get();
while (true) {
j = c13416fZs.b.get();
j2 = c13416fZs.e.get();
if (j5 == j2) {
break;
} else {
j5 = j2;
}
}
if ((((int) (j - j2)) >> 1) <= j4) {
return;
}
}
c13416fZs.b();
c13416fZs.b();
}
}
@Override // o.InterfaceC13174fSv
public final void onError(Throwable th) {
this.a = th;
c();
}
@Override // o.InterfaceC13174fSv
public final void onComplete() {
c();
}
@Override // o.fSJ
public final void dispose() {
if (this.e) {
return;
}
this.e = true;
this.f.dispose();
if (compareAndSet(false, true)) {
this.g.e();
}
}
private void c() {
Throwable th;
if (compareAndSet(false, true)) {
InterfaceC13174fSv<? super T> interfaceC13174fSv = this.d;
C13416fZs<Object> c13416fZs = this.g;
boolean z = this.b;
long b = AbstractC13173fSu.b(this.i);
long j = this.j;
while (!this.e) {
if (!z && (th = this.a) != null) {
c13416fZs.e();
interfaceC13174fSv.onError(th);
return;
}
Object b2 = c13416fZs.b();
if (b2 == null) {
Throwable th2 = this.a;
if (th2 != null) {
interfaceC13174fSv.onError(th2);
return;
} else {
interfaceC13174fSv.onComplete();
return;
}
}
Object b3 = c13416fZs.b();
if (((Long) b2).longValue() >= b - j) {
interfaceC13174fSv.onNext(b3);
}
}
c13416fZs.e();
}
}
@Override // o.fSJ
public final boolean isDisposed() {
return this.e;
}
}
}