package o;

import java.io.IOException;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class DF extends Oc0 {
    public final /* synthetic */ int e;
    public final /* synthetic */ Object f;
    public final /* synthetic */ Object g;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public /* synthetic */ DF(int i, Object obj, Object obj2, String str) {
        super(str, true);
        this.e = i;
        this.f = obj;
        this.g = obj2;
    }

    @Override // o.Oc0
    public final long a() {
        int i;
        long jA;
        RF[] rfArr;
        switch (this.e) {
            case 0:
                ((KF) this.f).l.a((C2880x70) ((B10) this.g).l);
                return -1L;
            case 1:
                try {
                    ((KF) this.f).l.b((RF) this.g);
                } catch (IOException e) {
                    ZW zw = ZW.a;
                    ZW zw2 = ZW.a;
                    String str = "Http2Connection.Listener failure for " + ((KF) this.f).n;
                    zw2.getClass();
                    ZW.i(str, 4, e);
                    try {
                        ((RF) this.g).c(2, e);
                    } catch (IOException unused) {
                    }
                }
                return -1L;
            default:
                FF ff = (FF) this.f;
                C2880x70 c2880x70 = (C2880x70) this.g;
                B10 b10 = new B10();
                KF kf = ff.m;
                synchronized (kf.H) {
                    synchronized (kf) {
                        try {
                            C2880x70 c2880x702 = kf.B;
                            C2880x70 c2880x703 = new C2880x70();
                            i = 0;
                            for (int i2 = 0; i2 < 10; i2++) {
                                if (((1 << i2) & c2880x702.a) != 0) {
                                    c2880x703.b(i2, c2880x702.b[i2]);
                                }
                            }
                            for (int i3 = 0; i3 < 10; i3++) {
                                if (((1 << i3) & c2880x70.a) != 0) {
                                    c2880x703.b(i3, c2880x70.b[i3]);
                                }
                            }
                            b10.l = c2880x703;
                            jA = c2880x703.a() - c2880x702.a();
                            rfArr = (jA == 0 || kf.m.isEmpty()) ? null : (RF[]) kf.m.values().toArray(new RF[0]);
                            kf.B = (C2880x70) b10.l;
                            kf.u.c(new DF(i, kf, b10, kf.n + " onSettings"), 0L);
                        } catch (Throwable th) {
                            throw th;
                        }
                    }
                    try {
                        kf.H.b((C2880x70) b10.l);
                    } catch (IOException e2) {
                        kf.b(2, 2, e2);
                    }
                }
                if (rfArr != null) {
                    int length = rfArr.length;
                    while (i < length) {
                        RF rf = rfArr[i];
                        synchronized (rf) {
                            rf.f += jA;
                            if (jA > 0) {
                                rf.notifyAll();
                            }
                        }
                        i++;
                    }
                }
                return -1L;
        }
    }
}
