导航菜单

页面标题

页面副标题

CityMall v1.42.1 - d.java 源代码

正在查看: CityMall v1.42.1 应用的 d.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package C7;

import D7.C0123f;
import java.io.Closeable;
import java.io.IOException;
import java.net.ProtocolException;
import java.net.SocketTimeoutException;
import java.util.ArrayDeque;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import kotlin.collections.AbstractC0471p;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.j;
import kotlin.jvm.internal.x;
import kotlin.jvm.internal.z;
import kotlin.text.k;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.EventListener;
import okhttp3.WebSocket;
import okhttp3.internal.concurrent.TaskRunner;
import okhttp3.internal.ws.WebSocketReader;
import okio.BufferedSink;
import okio.BufferedSource;
import p7.A;
import p7.s;
import p7.t;
import p7.u;
import p7.w;

public final class d implements WebSocket, WebSocketReader.FrameCallback {
    public static final b A = new b(null);
    private static final List z = AbstractC0471p.e(t.HTTP_1_1);
    private final String a;
    private Call b;
    private t7.a c;
    private WebSocketReader d;
    private C7.g e;
    private t7.d f;
    private String g;
    private AbstractC0001d h;
    private final ArrayDeque i;
    private final ArrayDeque j;
    private long k;
    private boolean l;
    private int m;
    private String n;
    private boolean o;
    private int p;
    private int q;
    private int r;
    private boolean s;
    private final u t;
    private final A u;
    private final Random v;
    private final long w;
    private C7.e x;
    private long y;

    public static final class a {
        private final int a;
        private final C0123f b;
        private final long c;

        public a(int i, C0123f c0123f, long j) {
            this.a = i;
            this.b = c0123f;
            this.c = j;
        }

        public final long a() {
            return this.c;
        }

        public final int b() {
            return this.a;
        }

        public final C0123f c() {
            return this.b;
        }
    }

    public static final class b {
        private b() {
        }

        public b(DefaultConstructorMarker defaultConstructorMarker) {
            this();
        }
    }

    public static final class c {
        private final int a;
        private final C0123f b;

        public c(int i, C0123f data) {
            j.i(data, "data");
            this.a = i;
            this.b = data;
        }

        public final C0123f a() {
            return this.b;
        }

        public final int b() {
            return this.a;
        }
    }

    public static abstract class AbstractC0001d implements Closeable {
        private final boolean a;
        private final BufferedSource b;
        private final BufferedSink c;

        public AbstractC0001d(boolean z, BufferedSource source, BufferedSink sink) {
            j.i(source, "source");
            j.i(sink, "sink");
            this.a = z;
            this.b = source;
            this.c = sink;
        }

        public final boolean c() {
            return this.a;
        }

        public final BufferedSink f() {
            return this.c;
        }

        public final BufferedSource n() {
            return this.b;
        }
    }

    private final class e extends t7.a {
        public e() {
            super(d.this.g + " writer", false, 2, null);
        }

        @Override
        public long f() {
            try {
                return d.this.x() ? 0L : -1L;
            } catch (IOException e) {
                d.this.q(e, null);
                return -1L;
            }
        }
    }

    public static final class f implements Callback {
        final u b;

        f(u uVar) {
            this.b = uVar;
        }

        @Override
        public void onFailure(Call call, IOException e) {
            j.i(call, "call");
            j.i(e, "e");
            d.this.q(e, null);
        }

        @Override
        public void onResponse(Call call, w response) {
            j.i(call, "call");
            j.i(response, "response");
            u7.c v = response.v();
            try {
                d.this.n(response, v);
                j.f(v);
                AbstractC0001d m = v.m();
                C7.e a = C7.e.g.a(response.R());
                d.this.x = a;
                if (!d.this.t(a)) {
                    synchronized (d.this) {
                        d.this.j.clear();
                        d.this.f(1010, "unexpected Sec-WebSocket-Extensions in response header");
                    }
                }
                try {
                    d.this.s(q7.c.i + " WebSocket " + this.b.l().q(), m);
                    d.this.r().f(d.this, response);
                    d.this.u();
                } catch (Exception e) {
                    d.this.q(e, null);
                }
            } catch (IOException e2) {
                if (v != null) {
                    v.u();
                }
                d.this.q(e2, response);
                q7.c.j(response);
            }
        }
    }

    public static final class g extends t7.a {
        final String e;
        final long f;
        final d g;
        final String h;
        final AbstractC0001d i;
        final C7.e j;

        public g(String str, String str2, long j, d dVar, String str3, AbstractC0001d abstractC0001d, C7.e eVar) {
            super(str2, false, 2, null);
            this.e = str;
            this.f = j;
            this.g = dVar;
            this.h = str3;
            this.i = abstractC0001d;
            this.j = eVar;
        }

        @Override
        public long f() {
            this.g.y();
            return this.f;
        }
    }

    public static final class h extends t7.a {
        final String e;
        final boolean f;
        final d g;
        final C7.g h;
        final C0123f i;
        final z j;
        final x k;
        final z l;
        final z m;
        final z n;
        final z o;

        public h(String str, boolean z, String str2, boolean z2, d dVar, C7.g gVar, C0123f c0123f, z zVar, x xVar, z zVar2, z zVar3, z zVar4, z zVar5) {
            super(str2, z2);
            this.e = str;
            this.f = z;
            this.g = dVar;
            this.h = gVar;
            this.i = c0123f;
            this.j = zVar;
            this.k = xVar;
            this.l = zVar2;
            this.m = zVar3;
            this.n = zVar4;
            this.o = zVar5;
        }

        @Override
        public long f() {
            this.g.m();
            return -1L;
        }
    }

    public d(TaskRunner taskRunner, u originalRequest, A listener, Random random, long j, C7.e eVar, long j2) {
        j.i(taskRunner, "taskRunner");
        j.i(originalRequest, "originalRequest");
        j.i(listener, "listener");
        j.i(random, "random");
        this.t = originalRequest;
        this.u = listener;
        this.v = random;
        this.w = j;
        this.x = eVar;
        this.y = j2;
        this.f = taskRunner.i();
        this.i = new ArrayDeque();
        this.j = new ArrayDeque();
        this.m = -1;
        if (!j.d("GET", originalRequest.h())) {
            throw new IllegalArgumentException(("Request must be GET: " + originalRequest.h()).toString());
        }
        C0123f.a aVar = C0123f.d;
        byte[] bArr = new byte[16];
        random.nextBytes(bArr);
        K6.A a2 = K6.A.a;
        this.a = C0123f.a.g(aVar, bArr, 0, 0, 3, null).a();
    }

    public final boolean t(C7.e eVar) {
        if (eVar.f || eVar.b != null) {
            return false;
        }
        Integer num = eVar.d;
        if (num == null) {
            return true;
        }
        int intValue = num.intValue();
        return 8 <= intValue && 15 >= intValue;
    }

    private final void v() {
        if (!q7.c.h || Thread.holdsLock(this)) {
            t7.a aVar = this.c;
            if (aVar != null) {
                t7.d.j(this.f, aVar, 0L, 2, null);
                return;
            }
            return;
        }
        StringBuilder sb = new StringBuilder();
        sb.append("Thread ");
        Thread currentThread = Thread.currentThread();
        j.h(currentThread, "Thread.currentThread()");
        sb.append(currentThread.getName());
        sb.append(" MUST hold lock on ");
        sb.append(this);
        throw new AssertionError(sb.toString());
    }

    private final synchronized boolean w(C0123f c0123f, int i) {
        if (!this.o && !this.l) {
            if (this.k + c0123f.H() > 16777216) {
                f(1001, null);
                return false;
            }
            this.k += c0123f.H();
            this.j.add(new c(i, c0123f));
            v();
            return true;
        }
        return false;
    }

    @Override
    public boolean a(String text) {
        j.i(text, "text");
        return w(C0123f.d.d(text), 1);
    }

    @Override
    public void b(String text) {
        j.i(text, "text");
        this.u.e(this, text);
    }

    @Override
    public synchronized void c(C0123f payload) {
        try {
            j.i(payload, "payload");
            if (!this.o && (!this.l || !this.j.isEmpty())) {
                this.i.add(payload);
                v();
                this.q++;
            }
        } finally {
        }
    }

    @Override
    public boolean d(C0123f bytes) {
        j.i(bytes, "bytes");
        return w(bytes, 2);
    }

    @Override
    public synchronized void e(C0123f payload) {
        j.i(payload, "payload");
        this.r++;
        this.s = false;
    }

    @Override
    public boolean f(int i, String str) {
        return o(i, str, 60000L);
    }

    @Override
    public void g(C0123f bytes) {
        j.i(bytes, "bytes");
        this.u.d(this, bytes);
    }

    @Override
    public void h(int i, String reason) {
        AbstractC0001d abstractC0001d;
        WebSocketReader webSocketReader;
        C7.g gVar;
        j.i(reason, "reason");
        if (!(i != -1)) {
            throw new IllegalArgumentException("Failed requirement.");
        }
        synchronized (this) {
            try {
                if (!(this.m == -1)) {
                    throw new IllegalStateException("already closed");
                }
                this.m = i;
                this.n = reason;
                abstractC0001d = null;
                if (this.l && this.j.isEmpty()) {
                    AbstractC0001d abstractC0001d2 = this.h;
                    this.h = null;
                    webSocketReader = this.d;
                    this.d = null;
                    gVar = this.e;
                    this.e = null;
                    this.f.n();
                    abstractC0001d = abstractC0001d2;
                } else {
                    webSocketReader = null;
                    gVar = null;
                }
                K6.A a2 = K6.A.a;
            } catch (Throwable th) {
                throw th;
            }
        }
        try {
            this.u.b(this, i, reason);
            if (abstractC0001d != null) {
                this.u.a(this, i, reason);
            }
        } finally {
            if (abstractC0001d != null) {
                q7.c.j(abstractC0001d);
            }
            if (webSocketReader != null) {
                q7.c.j(webSocketReader);
            }
            if (gVar != null) {
                q7.c.j(gVar);
            }
        }
    }

    public void m() {
        Call call = this.b;
        j.f(call);
        call.cancel();
    }

    public final void n(w response, u7.c cVar) {
        j.i(response, "response");
        if (response.u() != 101) {
            throw new ProtocolException("Expected HTTP 101 response but was '" + response.u() + ' ' + response.T() + '\'');
        }
        String I = w.I(response, "Connection", null, 2, null);
        if (!k.t("Upgrade", I, true)) {
            throw new ProtocolException("Expected 'Connection' header value 'Upgrade' but was '" + I + '\'');
        }
        String I2 = w.I(response, "Upgrade", null, 2, null);
        if (!k.t("websocket", I2, true)) {
            throw new ProtocolException("Expected 'Upgrade' header value 'websocket' but was '" + I2 + '\'');
        }
        String I3 = w.I(response, "Sec-WebSocket-Accept", null, 2, null);
        String a2 = C0123f.d.d(this.a + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11").F().a();
        if (j.d(a2, I3)) {
            if (cVar == null) {
                throw new ProtocolException("Web Socket exchange missing: bad interceptor?");
            }
            return;
        }
        throw new ProtocolException("Expected 'Sec-WebSocket-Accept' header value '" + a2 + "' but was '" + I3 + '\'');
    }

    public final synchronized boolean o(int i, String str, long j) {
        C0123f c0123f;
        try {
            C7.f.a.c(i);
            if (str != null) {
                c0123f = C0123f.d.d(str);
                if (!(((long) c0123f.H()) <= 123)) {
                    throw new IllegalArgumentException(("reason.size() > 123: " + str).toString());
                }
            } else {
                c0123f = null;
            }
            if (!this.o && !this.l) {
                this.l = true;
                this.j.add(new a(i, c0123f, j));
                v();
                return true;
            }
            return false;
        } finally {
        }
    }

    public final void p(s client) {
        j.i(client, "client");
        if (this.t.d("Sec-WebSocket-Extensions") != null) {
            q(new ProtocolException("Request header not permitted: 'Sec-WebSocket-Extensions'"), null);
            return;
        }
        s c2 = client.D().i(EventListener.a).Q(z).c();
        u b2 = this.t.i().e("Upgrade", "websocket").e("Connection", "Upgrade").e("Sec-WebSocket-Key", this.a).e("Sec-WebSocket-Version", "13").e("Sec-WebSocket-Extensions", "permessage-deflate").b();
        u7.e eVar = new u7.e(c2, b2, true);
        this.b = eVar;
        j.f(eVar);
        eVar.B(new f(b2));
    }

    public final void q(Exception e2, w wVar) {
        j.i(e2, "e");
        synchronized (this) {
            if (this.o) {
                return;
            }
            this.o = true;
            AbstractC0001d abstractC0001d = this.h;
            this.h = null;
            WebSocketReader webSocketReader = this.d;
            this.d = null;
            C7.g gVar = this.e;
            this.e = null;
            this.f.n();
            K6.A a2 = K6.A.a;
            try {
                this.u.c(this, e2, wVar);
            } finally {
                if (abstractC0001d != null) {
                    q7.c.j(abstractC0001d);
                }
                if (webSocketReader != null) {
                    q7.c.j(webSocketReader);
                }
                if (gVar != null) {
                    q7.c.j(gVar);
                }
            }
        }
    }

    public final A r() {
        return this.u;
    }

    public final void s(String name, AbstractC0001d streams) {
        j.i(name, "name");
        j.i(streams, "streams");
        C7.e eVar = this.x;
        j.f(eVar);
        synchronized (this) {
            try {
                this.g = name;
                this.h = streams;
                this.e = new C7.g(streams.c(), streams.f(), this.v, eVar.a, eVar.a(streams.c()), this.y);
                this.c = new e();
                long j = this.w;
                if (j != 0) {
                    long nanos = TimeUnit.MILLISECONDS.toNanos(j);
                    String str = name + " ping";
                    this.f.i(new g(str, str, nanos, this, name, streams, eVar), nanos);
                }
                if (!this.j.isEmpty()) {
                    v();
                }
                K6.A a2 = K6.A.a;
            } catch (Throwable th) {
                throw th;
            }
        }
        this.d = new WebSocketReader(streams.c(), streams.n(), this, eVar.a, eVar.a(!streams.c()));
    }

    public final void u() {
        while (this.m == -1) {
            WebSocketReader webSocketReader = this.d;
            j.f(webSocketReader);
            webSocketReader.c();
        }
    }

    public final boolean x() {
        throw new UnsupportedOperationException("Method not decompiled: C7.d.x():boolean");
    }

    public final void y() {
        synchronized (this) {
            try {
                if (this.o) {
                    return;
                }
                C7.g gVar = this.e;
                if (gVar != null) {
                    int i = this.s ? this.p : -1;
                    this.p++;
                    this.s = true;
                    K6.A a2 = K6.A.a;
                    if (i == -1) {
                        try {
                            gVar.p(C0123f.e);
                            return;
                        } catch (IOException e2) {
                            q(e2, null);
                            return;
                        }
                    }
                    q(new SocketTimeoutException("sent ping but didn't receive pong within " + this.w + "ms (after " + (i - 1) + " successful ping/pongs)"), null);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }
}