550 lines
17 KiB
Java
550 lines
17 KiB
Java
|
package o;
|
||
|
|
||
|
import io.reactivex.rxjava3.exceptions.QueueOverflowException;
|
||
|
import java.util.concurrent.atomic.AtomicLong;
|
||
|
import o.AbstractC13173fSu;
|
||
|
|
||
|
/* renamed from: o.fUz, reason: case insensitive filesystem */
|
||
|
/* loaded from: classes6.dex */
|
||
|
public final class C13247fUz<T> extends AbstractC13240fUs<T, T> {
|
||
|
private boolean b;
|
||
|
private AbstractC13173fSu c;
|
||
|
private int d;
|
||
|
|
||
|
public C13247fUz(AbstractC13155fSc<T> abstractC13155fSc, AbstractC13173fSu abstractC13173fSu, int i) {
|
||
|
super(abstractC13155fSc);
|
||
|
this.c = abstractC13173fSu;
|
||
|
this.b = false;
|
||
|
this.d = i;
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC13155fSc
|
||
|
public final void c(InterfaceC15338gnn<? super T> interfaceC15338gnn) {
|
||
|
AbstractC13173fSu.Sts c = this.c.c();
|
||
|
if (interfaceC15338gnn instanceof InterfaceC13405fZh) {
|
||
|
this.e.a((InterfaceC13158fSf) new IeS((InterfaceC13405fZh) interfaceC15338gnn, c, this.b, this.d));
|
||
|
} else {
|
||
|
this.e.a((InterfaceC13158fSf) new LWm(interfaceC15338gnn, c, this.b, this.d));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* renamed from: o.fUz$HBt */
|
||
|
/* loaded from: classes6.dex */
|
||
|
static abstract class HBt<T> extends fYD<T> implements InterfaceC13158fSf<T>, Runnable {
|
||
|
final int a;
|
||
|
volatile boolean b;
|
||
|
Throwable c;
|
||
|
final int d;
|
||
|
volatile boolean e;
|
||
|
long f;
|
||
|
InterfaceC13414fZq<T> g;
|
||
|
InterfaceC15337gnm h;
|
||
|
int i;
|
||
|
final AtomicLong j = new AtomicLong();
|
||
|
final AbstractC13173fSu.Sts k;
|
||
|
private boolean m;
|
||
|
private boolean n;
|
||
|
|
||
|
abstract void d();
|
||
|
|
||
|
abstract void f();
|
||
|
|
||
|
abstract void i();
|
||
|
|
||
|
HBt(AbstractC13173fSu.Sts sts, boolean z, int i) {
|
||
|
this.k = sts;
|
||
|
this.m = z;
|
||
|
this.d = i;
|
||
|
this.a = i - (i >> 2);
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC15338gnn
|
||
|
public final void onError(Throwable th) {
|
||
|
if (this.e) {
|
||
|
C13418fZu.c(th);
|
||
|
return;
|
||
|
}
|
||
|
this.c = th;
|
||
|
this.e = true;
|
||
|
if (getAndIncrement() == 0) {
|
||
|
this.k.c(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC15337gnm
|
||
|
public final void c(long j) {
|
||
|
if (fYC.e(j)) {
|
||
|
fYK.c(this.j, j);
|
||
|
if (getAndIncrement() == 0) {
|
||
|
this.k.c(this);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC15337gnm
|
||
|
public final void a() {
|
||
|
if (this.b) {
|
||
|
return;
|
||
|
}
|
||
|
this.b = true;
|
||
|
this.h.a();
|
||
|
this.k.dispose();
|
||
|
if (this.n || getAndIncrement() != 0) {
|
||
|
return;
|
||
|
}
|
||
|
this.g.e();
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
if (this.n) {
|
||
|
f();
|
||
|
} else if (this.i == 1) {
|
||
|
i();
|
||
|
} else {
|
||
|
d();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
final boolean a(boolean z, boolean z2, InterfaceC15338gnn<?> interfaceC15338gnn) {
|
||
|
if (this.b) {
|
||
|
this.g.e();
|
||
|
return true;
|
||
|
}
|
||
|
if (!z) {
|
||
|
return false;
|
||
|
}
|
||
|
if (this.m) {
|
||
|
if (!z2) {
|
||
|
return false;
|
||
|
}
|
||
|
this.b = true;
|
||
|
Throwable th = this.c;
|
||
|
if (th != null) {
|
||
|
interfaceC15338gnn.onError(th);
|
||
|
} else {
|
||
|
interfaceC15338gnn.onComplete();
|
||
|
}
|
||
|
this.k.dispose();
|
||
|
return true;
|
||
|
}
|
||
|
Throwable th2 = this.c;
|
||
|
if (th2 != null) {
|
||
|
this.b = true;
|
||
|
this.g.e();
|
||
|
interfaceC15338gnn.onError(th2);
|
||
|
this.k.dispose();
|
||
|
return true;
|
||
|
}
|
||
|
if (!z2) {
|
||
|
return false;
|
||
|
}
|
||
|
this.b = true;
|
||
|
interfaceC15338gnn.onComplete();
|
||
|
this.k.dispose();
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13414fZq
|
||
|
public final void e() {
|
||
|
this.g.e();
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13414fZq
|
||
|
public final boolean c() {
|
||
|
return this.g.c();
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC15338gnn
|
||
|
public final void onComplete() {
|
||
|
if (this.e) {
|
||
|
return;
|
||
|
}
|
||
|
this.e = true;
|
||
|
if (getAndIncrement() == 0) {
|
||
|
this.k.c(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC15338gnn
|
||
|
public final void onNext(T t) {
|
||
|
if (this.e) {
|
||
|
return;
|
||
|
}
|
||
|
if (this.i != 2) {
|
||
|
if (!this.g.b(t)) {
|
||
|
this.h.a();
|
||
|
this.c = new QueueOverflowException();
|
||
|
this.e = true;
|
||
|
}
|
||
|
if (getAndIncrement() == 0) {
|
||
|
this.k.c(this);
|
||
|
return;
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
if (getAndIncrement() == 0) {
|
||
|
this.k.c(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13413fZp
|
||
|
public final int b(int i) {
|
||
|
if ((i & 2) == 0) {
|
||
|
return 0;
|
||
|
}
|
||
|
this.n = true;
|
||
|
return 2;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* renamed from: o.fUz$LWm */
|
||
|
/* loaded from: classes6.dex */
|
||
|
static final class LWm<T> extends HBt<T> {
|
||
|
private InterfaceC15338gnn<? super T> m;
|
||
|
|
||
|
LWm(InterfaceC15338gnn<? super T> interfaceC15338gnn, AbstractC13173fSu.Sts sts, boolean z, int i) {
|
||
|
super(sts, z, i);
|
||
|
this.m = interfaceC15338gnn;
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13158fSf, o.InterfaceC15338gnn
|
||
|
public final void c(InterfaceC15337gnm interfaceC15337gnm) {
|
||
|
if (fYC.e(this.h, interfaceC15337gnm)) {
|
||
|
this.h = interfaceC15337gnm;
|
||
|
if (interfaceC15337gnm instanceof InterfaceC13410fZm) {
|
||
|
InterfaceC13410fZm interfaceC13410fZm = (InterfaceC13410fZm) interfaceC15337gnm;
|
||
|
int b = interfaceC13410fZm.b(7);
|
||
|
if (b == 1) {
|
||
|
this.i = 1;
|
||
|
this.g = interfaceC13410fZm;
|
||
|
this.e = true;
|
||
|
this.m.c(this);
|
||
|
return;
|
||
|
}
|
||
|
if (b == 2) {
|
||
|
this.i = 2;
|
||
|
this.g = interfaceC13410fZm;
|
||
|
this.m.c(this);
|
||
|
interfaceC15337gnm.c(this.d);
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
this.g = new C13415fZr(this.d);
|
||
|
this.m.c(this);
|
||
|
interfaceC15337gnm.c(this.d);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.C13247fUz.HBt
|
||
|
final void i() {
|
||
|
InterfaceC15338gnn<? super T> interfaceC15338gnn = this.m;
|
||
|
InterfaceC13414fZq<T> interfaceC13414fZq = this.g;
|
||
|
long j = this.f;
|
||
|
int i = 1;
|
||
|
do {
|
||
|
long j2 = this.j.get();
|
||
|
while (j != j2) {
|
||
|
try {
|
||
|
T b = interfaceC13414fZq.b();
|
||
|
if (this.b) {
|
||
|
return;
|
||
|
}
|
||
|
if (b == null) {
|
||
|
this.b = true;
|
||
|
interfaceC15338gnn.onComplete();
|
||
|
this.k.dispose();
|
||
|
return;
|
||
|
}
|
||
|
interfaceC15338gnn.onNext(b);
|
||
|
j++;
|
||
|
} catch (Throwable th) {
|
||
|
C13147fSI.c(th);
|
||
|
this.b = true;
|
||
|
this.h.a();
|
||
|
interfaceC15338gnn.onError(th);
|
||
|
this.k.dispose();
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
if (this.b) {
|
||
|
return;
|
||
|
}
|
||
|
if (interfaceC13414fZq.c()) {
|
||
|
this.b = true;
|
||
|
interfaceC15338gnn.onComplete();
|
||
|
this.k.dispose();
|
||
|
return;
|
||
|
}
|
||
|
this.f = j;
|
||
|
i = addAndGet(-i);
|
||
|
} while (i != 0);
|
||
|
}
|
||
|
|
||
|
@Override // o.C13247fUz.HBt
|
||
|
final void d() {
|
||
|
InterfaceC15338gnn<? super T> interfaceC15338gnn = this.m;
|
||
|
InterfaceC13414fZq<T> interfaceC13414fZq = this.g;
|
||
|
long j = this.f;
|
||
|
int i = 1;
|
||
|
while (true) {
|
||
|
long j2 = this.j.get();
|
||
|
while (j != j2) {
|
||
|
boolean z = this.e;
|
||
|
try {
|
||
|
T b = interfaceC13414fZq.b();
|
||
|
boolean z2 = b == null;
|
||
|
if (!a(z, z2, interfaceC15338gnn)) {
|
||
|
if (z2) {
|
||
|
break;
|
||
|
}
|
||
|
interfaceC15338gnn.onNext(b);
|
||
|
j++;
|
||
|
if (j == this.a) {
|
||
|
if (j2 != Long.MAX_VALUE) {
|
||
|
j2 = this.j.addAndGet(-j);
|
||
|
}
|
||
|
this.h.c(j);
|
||
|
j = 0;
|
||
|
}
|
||
|
} else {
|
||
|
return;
|
||
|
}
|
||
|
} catch (Throwable th) {
|
||
|
C13147fSI.c(th);
|
||
|
this.b = true;
|
||
|
this.h.a();
|
||
|
interfaceC13414fZq.e();
|
||
|
interfaceC15338gnn.onError(th);
|
||
|
this.k.dispose();
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
if (j == j2 && a(this.e, interfaceC13414fZq.c(), interfaceC15338gnn)) {
|
||
|
return;
|
||
|
}
|
||
|
int i2 = get();
|
||
|
if (i == i2) {
|
||
|
this.f = j;
|
||
|
i = addAndGet(-i);
|
||
|
if (i == 0) {
|
||
|
return;
|
||
|
}
|
||
|
} else {
|
||
|
i = i2;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.C13247fUz.HBt
|
||
|
final void f() {
|
||
|
int i = 1;
|
||
|
while (!this.b) {
|
||
|
boolean z = this.e;
|
||
|
this.m.onNext(null);
|
||
|
if (z) {
|
||
|
this.b = true;
|
||
|
Throwable th = this.c;
|
||
|
if (th != null) {
|
||
|
this.m.onError(th);
|
||
|
} else {
|
||
|
this.m.onComplete();
|
||
|
}
|
||
|
this.k.dispose();
|
||
|
return;
|
||
|
}
|
||
|
i = addAndGet(-i);
|
||
|
if (i == 0) {
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13414fZq
|
||
|
public final T b() throws Throwable {
|
||
|
T b = this.g.b();
|
||
|
if (b != null && this.i != 1) {
|
||
|
long j = this.f + 1;
|
||
|
if (j == this.a) {
|
||
|
this.f = 0L;
|
||
|
this.h.c(j);
|
||
|
} else {
|
||
|
this.f = j;
|
||
|
}
|
||
|
}
|
||
|
return b;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* renamed from: o.fUz$IeS */
|
||
|
/* loaded from: classes6.dex */
|
||
|
static final class IeS<T> extends HBt<T> {
|
||
|
private InterfaceC13405fZh<? super T> m;
|
||
|
private long n;
|
||
|
|
||
|
IeS(InterfaceC13405fZh<? super T> interfaceC13405fZh, AbstractC13173fSu.Sts sts, boolean z, int i) {
|
||
|
super(sts, z, i);
|
||
|
this.m = interfaceC13405fZh;
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13158fSf, o.InterfaceC15338gnn
|
||
|
public final void c(InterfaceC15337gnm interfaceC15337gnm) {
|
||
|
if (fYC.e(this.h, interfaceC15337gnm)) {
|
||
|
this.h = interfaceC15337gnm;
|
||
|
if (interfaceC15337gnm instanceof InterfaceC13410fZm) {
|
||
|
InterfaceC13410fZm interfaceC13410fZm = (InterfaceC13410fZm) interfaceC15337gnm;
|
||
|
int b = interfaceC13410fZm.b(7);
|
||
|
if (b == 1) {
|
||
|
this.i = 1;
|
||
|
this.g = interfaceC13410fZm;
|
||
|
this.e = true;
|
||
|
this.m.c(this);
|
||
|
return;
|
||
|
}
|
||
|
if (b == 2) {
|
||
|
this.i = 2;
|
||
|
this.g = interfaceC13410fZm;
|
||
|
this.m.c(this);
|
||
|
interfaceC15337gnm.c(this.d);
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
this.g = new C13415fZr(this.d);
|
||
|
this.m.c(this);
|
||
|
interfaceC15337gnm.c(this.d);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.C13247fUz.HBt
|
||
|
final void i() {
|
||
|
InterfaceC13405fZh<? super T> interfaceC13405fZh = this.m;
|
||
|
InterfaceC13414fZq<T> interfaceC13414fZq = this.g;
|
||
|
long j = this.f;
|
||
|
int i = 1;
|
||
|
do {
|
||
|
long j2 = this.j.get();
|
||
|
while (j != j2) {
|
||
|
try {
|
||
|
T b = interfaceC13414fZq.b();
|
||
|
if (this.b) {
|
||
|
return;
|
||
|
}
|
||
|
if (b == null) {
|
||
|
this.b = true;
|
||
|
interfaceC13405fZh.onComplete();
|
||
|
this.k.dispose();
|
||
|
return;
|
||
|
} else if (interfaceC13405fZh.d()) {
|
||
|
j++;
|
||
|
}
|
||
|
} catch (Throwable th) {
|
||
|
C13147fSI.c(th);
|
||
|
this.b = true;
|
||
|
this.h.a();
|
||
|
interfaceC13405fZh.onError(th);
|
||
|
this.k.dispose();
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
if (this.b) {
|
||
|
return;
|
||
|
}
|
||
|
if (interfaceC13414fZq.c()) {
|
||
|
this.b = true;
|
||
|
interfaceC13405fZh.onComplete();
|
||
|
this.k.dispose();
|
||
|
return;
|
||
|
}
|
||
|
this.f = j;
|
||
|
i = addAndGet(-i);
|
||
|
} while (i != 0);
|
||
|
}
|
||
|
|
||
|
@Override // o.C13247fUz.HBt
|
||
|
final void d() {
|
||
|
InterfaceC13405fZh<? super T> interfaceC13405fZh = this.m;
|
||
|
InterfaceC13414fZq<T> interfaceC13414fZq = this.g;
|
||
|
long j = this.f;
|
||
|
long j2 = this.n;
|
||
|
int i = 1;
|
||
|
do {
|
||
|
long j3 = this.j.get();
|
||
|
while (j != j3) {
|
||
|
boolean z = this.e;
|
||
|
try {
|
||
|
boolean z2 = interfaceC13414fZq.b() == null;
|
||
|
if (!a(z, z2, interfaceC13405fZh)) {
|
||
|
if (z2) {
|
||
|
break;
|
||
|
}
|
||
|
if (interfaceC13405fZh.d()) {
|
||
|
j++;
|
||
|
}
|
||
|
j2++;
|
||
|
if (j2 == this.a) {
|
||
|
this.h.c(j2);
|
||
|
j2 = 0;
|
||
|
}
|
||
|
} else {
|
||
|
return;
|
||
|
}
|
||
|
} catch (Throwable th) {
|
||
|
C13147fSI.c(th);
|
||
|
this.b = true;
|
||
|
this.h.a();
|
||
|
interfaceC13414fZq.e();
|
||
|
interfaceC13405fZh.onError(th);
|
||
|
this.k.dispose();
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
if (j == j3 && a(this.e, interfaceC13414fZq.c(), interfaceC13405fZh)) {
|
||
|
return;
|
||
|
}
|
||
|
this.f = j;
|
||
|
this.n = j2;
|
||
|
i = addAndGet(-i);
|
||
|
} while (i != 0);
|
||
|
}
|
||
|
|
||
|
@Override // o.C13247fUz.HBt
|
||
|
final void f() {
|
||
|
int i = 1;
|
||
|
while (!this.b) {
|
||
|
boolean z = this.e;
|
||
|
this.m.onNext(null);
|
||
|
if (z) {
|
||
|
this.b = true;
|
||
|
Throwable th = this.c;
|
||
|
if (th != null) {
|
||
|
this.m.onError(th);
|
||
|
} else {
|
||
|
this.m.onComplete();
|
||
|
}
|
||
|
this.k.dispose();
|
||
|
return;
|
||
|
}
|
||
|
i = addAndGet(-i);
|
||
|
if (i == 0) {
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13414fZq
|
||
|
public final T b() throws Throwable {
|
||
|
T b = this.g.b();
|
||
|
if (b != null && this.i != 1) {
|
||
|
long j = this.n + 1;
|
||
|
if (j == this.a) {
|
||
|
this.n = 0L;
|
||
|
this.h.c(j);
|
||
|
} else {
|
||
|
this.n = j;
|
||
|
}
|
||
|
}
|
||
|
return b;
|
||
|
}
|
||
|
}
|
||
|
}
|