导航菜单

页面标题

页面副标题

Crafto v9.3.3 - j.java 源代码

正在查看: Crafto v9.3.3 应用的 j.java JAVA 源代码文件

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


package nj;

import Gf.i;
import Gf.t;
import Gf.v;
import Wl.A;
import Wl.C0217e;
import Wl.C0219g;
import Wl.G;
import Wl.H;
import Wl.N;
import Wl.O;
import io.grpc.StatusException;
import io.grpc.a;
import java.io.EOFException;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.URI;
import java.util.Collections;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.SocketFactory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import kotlin.jvm.internal.IntCompanionObject;
import kotlin.jvm.internal.LongCompanionObject;
import lj.C0795D;
import lj.C0796E;
import lj.C0801J;
import lj.C0826t;
import lj.C0828v;
import lj.EnumC0800I;
import lj.x;
import mj.C0;
import mj.C0874e0;
import mj.C0898q0;
import mj.InterfaceC0904u;
import mj.InterfaceC0906v;
import mj.InterfaceC0914z;
import mj.RunnableC0872d0;
import mj.X;
import mj.X0;
import mj.Y;
import mj.d1;
import mj.j1;
import nj.C0930a;
import nj.C0930a.d;
import nj.C0931b;
import nj.C0935f;
import nj.i;
import nj.p;
import nj.p.b;
import oj.EnumC0945a;
import oj.InterfaceC0946b;
import oj.g;
import pj.C0971a;
import pj.C0972b;

public final class j implements InterfaceC0914z, C0931b.a, p.c {
    public static final Map<EnumC0945a, C0801J> S;
    public static final Logger T;
    public final SocketFactory A;
    public final SSLSocketFactory B;
    public final HostnameVerifier C;
    public int D;
    public final LinkedList E;
    public final io.grpc.okhttp.internal.b F;
    public C0898q0 G;
    public boolean H;
    public long I;
    public long J;
    public boolean K;
    public final Runnable L;
    public final int M;
    public final boolean N;
    public final j1 O;
    public final a P;
    public final C0826t Q;
    public final int R;
    public final InetSocketAddress a;
    public final String b;
    public final String c;

    public final Random f849d;
    public final v<t> e;
    public final int f;
    public final oj.j g;
    public C0.a h;
    public C0931b i;
    public p j;
    public final Object k;
    public final x l;
    public int m;
    public final HashMap n;
    public final Executor o;
    public final X0 p;
    public final ScheduledExecutorService q;
    public final int r;
    public int s;
    public d t;
    public io.grpc.a u;
    public C0801J v;
    public boolean w;
    public C0874e0 x;
    public boolean y;
    public boolean z;

    public class a extends ii.o {
        public a() {
        }

        public final void a() {
            j.this.h.c(true);
        }

        public final void b() {
            j.this.h.c(false);
        }
    }

    public class c implements Runnable {
        public c() {
        }

        @Override
        public final void run() {
            j.this.getClass();
            j jVar = j.this;
            jVar.o.execute(jVar.t);
            synchronized (j.this.k) {
                j jVar2 = j.this;
                jVar2.D = IntCompanionObject.MAX_VALUE;
                jVar2.u();
            }
            j.this.getClass();
        }
    }

    public class d implements InterfaceC0946b.a, Runnable {
        public final InterfaceC0946b b;
        public final k a = new k(Level.FINE);
        public boolean c = true;

        public d(InterfaceC0946b interfaceC0946b) {
            this.b = interfaceC0946b;
        }

        @Override
        public final void run() {
            j jVar;
            C0801J c0801j;
            String name = Thread.currentThread().getName();
            Thread.currentThread().setName("OkHttpClientTransport");
            while (((g.c) this.b).a(this)) {
                try {
                    C0898q0 c0898q0 = j.this.G;
                    if (c0898q0 != null) {
                        c0898q0.a();
                    }
                } catch (Throwable th) {
                    try {
                        j jVar2 = j.this;
                        EnumC0945a enumC0945a = EnumC0945a.PROTOCOL_ERROR;
                        C0801J g = C0801J.l.h("error in frame handler").g(th);
                        Map<EnumC0945a, C0801J> map = j.S;
                        jVar2.t(0, enumC0945a, g);
                        try {
                            ((g.c) this.b).close();
                        } catch (IOException e) {
                            j.T.log(Level.INFO, "Exception closing frame reader", (Throwable) e);
                        }
                        jVar = j.this;
                    } catch (Throwable th2) {
                        try {
                            ((g.c) this.b).close();
                        } catch (IOException e2) {
                            j.T.log(Level.INFO, "Exception closing frame reader", (Throwable) e2);
                        }
                        j.this.h.d();
                        Thread.currentThread().setName(name);
                        throw th2;
                    }
                }
            }
            synchronized (j.this.k) {
                c0801j = j.this.v;
            }
            if (c0801j == null) {
                c0801j = C0801J.m.h("End of stream or IOException");
            }
            j.this.t(0, EnumC0945a.INTERNAL_ERROR, c0801j);
            try {
                ((g.c) this.b).close();
            } catch (IOException e3) {
                j.T.log(Level.INFO, "Exception closing frame reader", (Throwable) e3);
            }
            jVar = j.this;
            jVar.h.d();
            Thread.currentThread().setName(name);
        }
    }

    static {
        EnumMap enumMap = new EnumMap(EnumC0945a.class);
        EnumC0945a enumC0945a = EnumC0945a.NO_ERROR;
        C0801J c0801j = C0801J.l;
        enumMap.put((EnumMap) enumC0945a, (EnumC0945a) c0801j.h("No error: A GRPC status of OK should have been sent"));
        enumMap.put((EnumMap) EnumC0945a.PROTOCOL_ERROR, (EnumC0945a) c0801j.h("Protocol error"));
        enumMap.put((EnumMap) EnumC0945a.INTERNAL_ERROR, (EnumC0945a) c0801j.h("Internal error"));
        enumMap.put((EnumMap) EnumC0945a.FLOW_CONTROL_ERROR, (EnumC0945a) c0801j.h("Flow control error"));
        enumMap.put((EnumMap) EnumC0945a.STREAM_CLOSED, (EnumC0945a) c0801j.h("Stream closed"));
        enumMap.put((EnumMap) EnumC0945a.FRAME_TOO_LARGE, (EnumC0945a) c0801j.h("Frame too large"));
        enumMap.put((EnumMap) EnumC0945a.REFUSED_STREAM, (EnumC0945a) C0801J.m.h("Refused stream"));
        enumMap.put((EnumMap) EnumC0945a.CANCEL, (EnumC0945a) C0801J.f.h("Cancelled"));
        enumMap.put((EnumMap) EnumC0945a.COMPRESSION_ERROR, (EnumC0945a) c0801j.h("Compression error"));
        enumMap.put((EnumMap) EnumC0945a.CONNECT_ERROR, (EnumC0945a) c0801j.h("Connect error"));
        enumMap.put((EnumMap) EnumC0945a.ENHANCE_YOUR_CALM, (EnumC0945a) C0801J.k.h("Enhance your calm"));
        enumMap.put((EnumMap) EnumC0945a.INADEQUATE_SECURITY, (EnumC0945a) C0801J.i.h("Inadequate security"));
        S = Collections.unmodifiableMap(enumMap);
        T = Logger.getLogger(j.class.getName());
    }

    public j() {
        throw null;
    }

    public j(C0935f.C0111f c0111f, InetSocketAddress inetSocketAddress, String str, String str2, io.grpc.a aVar, C0826t c0826t, RunnableC0936g runnableC0936g) {
        Y.d dVar = Y.r;
        oj.g gVar = new oj.g();
        this.f849d = new Random();
        Object obj = new Object();
        this.k = obj;
        this.n = new HashMap();
        this.D = 0;
        this.E = new LinkedList();
        this.P = new a();
        this.R = 30000;
        Gf.m.i(inetSocketAddress, "address");
        this.a = inetSocketAddress;
        this.b = str;
        this.r = c0111f.j;
        this.f = c0111f.n;
        Executor executor = c0111f.b;
        Gf.m.i(executor, "executor");
        this.o = executor;
        this.p = new X0(c0111f.b);
        ScheduledExecutorService scheduledExecutorService = c0111f.f848d;
        Gf.m.i(scheduledExecutorService, "scheduledExecutorService");
        this.q = scheduledExecutorService;
        this.m = 3;
        SocketFactory socketFactory = c0111f.f;
        this.A = socketFactory == null ? SocketFactory.getDefault() : socketFactory;
        this.B = c0111f.g;
        this.C = c0111f.h;
        io.grpc.okhttp.internal.b bVar = c0111f.i;
        Gf.m.i(bVar, "connectionSpec");
        this.F = bVar;
        Gf.m.i(dVar, "stopwatchFactory");
        this.e = dVar;
        this.g = gVar;
        StringBuilder sb = new StringBuilder();
        if (str2 != null) {
            sb.append(str2);
            sb.append(' ');
        }
        sb.append("grpc-java-okhttp/1.57.2");
        this.c = sb.toString();
        this.Q = c0826t;
        this.L = runnableC0936g;
        this.M = c0111f.p;
        j1.a aVar2 = c0111f.e;
        aVar2.getClass();
        this.O = new j1(aVar2.a);
        this.l = x.a(j.class, inetSocketAddress.toString());
        io.grpc.a aVar3 = io.grpc.a.b;
        a.b<io.grpc.a> bVar2 = X.b;
        IdentityHashMap identityHashMap = new IdentityHashMap(1);
        identityHashMap.put(bVar2, aVar);
        for (Map.Entry<a.b<?>, Object> entry : aVar3.a.entrySet()) {
            if (!identityHashMap.containsKey(entry.getKey())) {
                identityHashMap.put(entry.getKey(), entry.getValue());
            }
        }
        this.u = new io.grpc.a(identityHashMap);
        this.N = c0111f.q;
        synchronized (obj) {
        }
    }

    public static void i(j jVar, EnumC0945a enumC0945a, String str) {
        jVar.getClass();
        jVar.t(0, enumC0945a, x(enumC0945a).b(str));
    }

    public static Socket j(j jVar, InetSocketAddress inetSocketAddress, InetSocketAddress inetSocketAddress2, String str, String str2) throws StatusException {
        String str3;
        int i;
        String str4;
        jVar.getClass();
        Socket socket = null;
        try {
            InetAddress address = inetSocketAddress2.getAddress();
            SocketFactory socketFactory = jVar.A;
            Socket createSocket = address != null ? socketFactory.createSocket(inetSocketAddress2.getAddress(), inetSocketAddress2.getPort()) : socketFactory.createSocket(inetSocketAddress2.getHostName(), inetSocketAddress2.getPort());
            try {
                createSocket.setTcpNoDelay(true);
                createSocket.setSoTimeout(jVar.R);
                C0217e g = A.g(createSocket);
                G a2 = A.a(A.d(createSocket));
                C0972b k = jVar.k(inetSocketAddress, str, str2);
                io.grpc.okhttp.internal.d dVar = k.b;
                C0971a c0971a = k.a;
                Locale locale = Locale.US;
                a2.U("CONNECT " + c0971a.a + ":" + c0971a.b + " HTTP/1.1");
                a2.U("\r\n");
                int length = dVar.a.length / 2;
                for (int i2 = 0; i2 < length; i2++) {
                    int i3 = i2 * 2;
                    String[] strArr = dVar.a;
                    if (i3 >= 0 && i3 < strArr.length) {
                        str3 = strArr[i3];
                        a2.U(str3);
                        a2.U(": ");
                        i = i3 + 1;
                        if (i >= 0 && i < strArr.length) {
                            str4 = strArr[i];
                            a2.U(str4);
                            a2.U("\r\n");
                        }
                        str4 = null;
                        a2.U(str4);
                        a2.U("\r\n");
                    }
                    str3 = null;
                    a2.U(str3);
                    a2.U(": ");
                    i = i3 + 1;
                    if (i >= 0) {
                        str4 = strArr[i];
                        a2.U(str4);
                        a2.U("\r\n");
                    }
                    str4 = null;
                    a2.U(str4);
                    a2.U("\r\n");
                }
                a2.U("\r\n");
                a2.flush();
                io.grpc.okhttp.internal.l a3 = io.grpc.okhttp.internal.l.a(r(g));
                while (!r(g).equals("")) {
                }
                int i4 = a3.b;
                if (i4 >= 200 && i4 < 300) {
                    createSocket.setSoTimeout(0);
                    return createSocket;
                }
                C0219g c0219g = new C0219g();
                try {
                    createSocket.shutdownOutput();
                    g.read(c0219g, 1024L);
                } catch (IOException e) {
                    c0219g.m1("Unable to read body: " + e.toString());
                }
                try {
                    createSocket.close();
                } catch (IOException unused) {
                }
                Locale locale2 = Locale.US;
                throw new StatusException(C0801J.m.h("Response returned from proxy was not successful (expected 2xx, got " + i4 + " " + a3.c + "). Response body:\n" + c0219g.e0()));
            } catch (IOException e2) {
                e = e2;
                socket = createSocket;
                if (socket != null) {
                    Y.b(socket);
                }
                throw new StatusException(C0801J.m.h("Failed trying to connect with proxy").g(e));
            }
        } catch (IOException e3) {
            e = e3;
        }
    }

    public static String r(C0217e c0217e) throws IOException {
        C0219g c0219g = new C0219g();
        while (c0217e.read(c0219g, 1L) != -1) {
            if (c0219g.C(c0219g.b - 1) == 10) {
                return c0219g.N(LongCompanionObject.MAX_VALUE);
            }
        }
        throw new EOFException("\\n not found: " + c0219g.C0(c0219g.b).f());
    }

    public static C0801J x(EnumC0945a enumC0945a) {
        C0801J c0801j = S.get(enumC0945a);
        if (c0801j != null) {
            return c0801j;
        }
        return C0801J.g.h("Unknown http2 error code: " + enumC0945a.httpCode);
    }

    @Override
    public final void a(Exception exc) {
        t(0, EnumC0945a.INTERNAL_ERROR, C0801J.m.g(exc));
    }

    @Override
    public final x b() {
        return this.l;
    }

    @Override
    public final Runnable c(C0.a aVar) {
        this.h = aVar;
        if (this.H) {
            C0898q0 c0898q0 = new C0898q0(new C0898q0.c(this), this.q, this.I, this.J, this.K);
            this.G = c0898q0;
            c0898q0.c();
        }
        C0930a c0930a = new C0930a(this.p, this);
        C0930a.d dVar = c0930a.new d(this.g.a(A.a(c0930a)));
        synchronized (this.k) {
            C0931b c0931b = new C0931b(this, dVar);
            this.i = c0931b;
            this.j = new p(this, c0931b);
        }
        CountDownLatch countDownLatch = new CountDownLatch(1);
        this.p.execute(new b(countDownLatch, c0930a));
        try {
            s();
            countDownLatch.countDown();
            this.p.execute(new c());
            return null;
        } catch (Throwable th) {
            countDownLatch.countDown();
            throw th;
        }
    }

    @Override
    public final void d(C0801J c0801j) {
        f(c0801j);
        synchronized (this.k) {
            try {
                Iterator it = this.n.entrySet().iterator();
                while (it.hasNext()) {
                    Map.Entry entry = (Map.Entry) it.next();
                    it.remove();
                    ((i) entry.getValue()).l.l(c0801j, false, new C0795D());
                    q((i) entry.getValue());
                }
                for (i iVar : this.E) {
                    iVar.l.k(c0801j, InterfaceC0906v.a.MISCARRIED, true, new C0795D());
                    q(iVar);
                }
                this.E.clear();
                w();
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    @Override
    public final p.b[] e() {
        p.b[] bVarArr;
        synchronized (this.k) {
            try {
                bVarArr = new p.b[this.n.size()];
                Iterator it = this.n.values().iterator();
                int i = 0;
                while (it.hasNext()) {
                    bVarArr[i] = ((i) it.next()).l.r();
                    i++;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        return bVarArr;
    }

    @Override
    public final void f(C0801J c0801j) {
        synchronized (this.k) {
            try {
                if (this.v != null) {
                    return;
                }
                this.v = c0801j;
                this.h.a(c0801j);
                w();
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    @Override
    public final void g(C0898q0.c.a aVar, Lf.c cVar) {
        long nextLong;
        synchronized (this.k) {
            try {
                boolean z = true;
                Gf.m.o(this.i != null);
                if (this.y) {
                    StatusException n = n();
                    Logger logger = C0874e0.g;
                    try {
                        cVar.execute(new RunnableC0872d0(aVar, n));
                    } catch (Throwable th) {
                        C0874e0.g.log(Level.SEVERE, "Failed to execute PingCallback", th);
                    }
                    return;
                }
                C0874e0 c0874e0 = this.x;
                if (c0874e0 != null) {
                    nextLong = 0;
                    z = false;
                } else {
                    nextLong = this.f849d.nextLong();
                    t tVar = (t) this.e.get();
                    tVar.b();
                    C0874e0 c0874e02 = new C0874e0(nextLong, tVar);
                    this.x = c0874e02;
                    this.O.getClass();
                    c0874e0 = c0874e02;
                }
                if (z) {
                    this.i.o((int) (nextLong >>> 32), (int) nextLong, false);
                }
                c0874e0.a(aVar, cVar);
            } catch (Throwable th2) {
                throw th2;
            }
        }
    }

    @Override
    public final InterfaceC0904u h(C0796E c0796e, C0795D c0795d, io.grpc.b bVar, io.grpc.c[] cVarArr) {
        Gf.m.i(c0796e, "method");
        Gf.m.i(c0795d, "headers");
        io.grpc.a aVar = this.u;
        d1 d1Var = new d1(cVarArr);
        for (io.grpc.c cVar : cVarArr) {
            cVar.A0(aVar, c0795d);
        }
        synchronized (this.k) {
            try {
                try {
                    return new i(c0796e, c0795d, this.i, this, this.j, this.k, this.r, this.f, this.b, this.c, d1Var, this.O, bVar, this.N);
                } catch (Throwable th) {
                    th = th;
                    throw th;
                }
            } catch (Throwable th2) {
                th = th2;
            }
        }
    }

    public final pj.C0972b k(java.net.InetSocketAddress r20, java.lang.String r21, java.lang.String r22) {
        throw new UnsupportedOperationException("Method not decompiled: nj.j.k(java.net.InetSocketAddress, java.lang.String, java.lang.String):pj.b");
    }

    public final void l(int i, C0801J c0801j, InterfaceC0906v.a aVar, boolean z, EnumC0945a enumC0945a, C0795D c0795d) {
        synchronized (this.k) {
            try {
                i iVar = (i) this.n.remove(Integer.valueOf(i));
                if (iVar != null) {
                    if (enumC0945a != null) {
                        this.i.I(i, EnumC0945a.CANCEL);
                    }
                    if (c0801j != null) {
                        i.b bVar = iVar.l;
                        if (c0795d == null) {
                            c0795d = new C0795D();
                        }
                        bVar.k(c0801j, aVar, z, c0795d);
                    }
                    if (!u()) {
                        w();
                        q(iVar);
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final int m() {
        URI a2 = Y.a(this.b);
        return a2.getPort() != -1 ? a2.getPort() : this.a.getPort();
    }

    public final StatusException n() {
        synchronized (this.k) {
            try {
                C0801J c0801j = this.v;
                if (c0801j != null) {
                    return new StatusException(c0801j);
                }
                return new StatusException(C0801J.m.h("Connection closed"));
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final i o(int i) {
        i iVar;
        synchronized (this.k) {
            iVar = (i) this.n.get(Integer.valueOf(i));
        }
        return iVar;
    }

    public final boolean p(int i) {
        boolean z;
        synchronized (this.k) {
            if (i < this.m) {
                z = true;
                if ((i & 1) == 1) {
                }
            }
            z = false;
        }
        return z;
    }

    public final void q(nj.i r5) {
        throw new UnsupportedOperationException("Method not decompiled: nj.j.q(nj.i):void");
    }

    public final void s() {
        synchronized (this.k) {
            try {
                this.i.F();
                oj.i iVar = new oj.i();
                iVar.b(7, this.f);
                this.i.w0(iVar);
                if (this.f > 65535) {
                    this.i.i(0, r1 - 65535);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final void t(int i, EnumC0945a enumC0945a, C0801J c0801j) {
        synchronized (this.k) {
            try {
                if (this.v == null) {
                    this.v = c0801j;
                    this.h.a(c0801j);
                }
                if (enumC0945a != null && !this.w) {
                    this.w = true;
                    this.i.T(enumC0945a, new byte[0]);
                }
                Iterator it = this.n.entrySet().iterator();
                while (it.hasNext()) {
                    Map.Entry entry = (Map.Entry) it.next();
                    if (((Integer) entry.getKey()).intValue() > i) {
                        it.remove();
                        ((i) entry.getValue()).l.k(c0801j, InterfaceC0906v.a.REFUSED, false, new C0795D());
                        q((i) entry.getValue());
                    }
                }
                for (i iVar : this.E) {
                    iVar.l.k(c0801j, InterfaceC0906v.a.MISCARRIED, true, new C0795D());
                    q(iVar);
                }
                this.E.clear();
                w();
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final String toString() {
        i.a b2 = Gf.i.b(this);
        b2.c("logId", this.l.c);
        b2.b(this.a, "address");
        return b2.toString();
    }

    public final boolean u() {
        boolean z = false;
        while (true) {
            LinkedList linkedList = this.E;
            if (linkedList.isEmpty() || this.n.size() >= this.D) {
                break;
            }
            v((i) linkedList.poll());
            z = true;
        }
        return z;
    }

    public final void v(i iVar) {
        Gf.m.n("StreamId already assigned", iVar.l.L == -1);
        this.n.put(Integer.valueOf(this.m), iVar);
        if (!this.z) {
            this.z = true;
            C0898q0 c0898q0 = this.G;
            if (c0898q0 != null) {
                c0898q0.b();
            }
        }
        if (iVar.c) {
            this.P.c(iVar, true);
        }
        i.b bVar = iVar.l;
        int i = this.m;
        Gf.m.l(i, "the stream has been started with id %s", bVar.L == -1);
        bVar.L = i;
        p pVar = bVar.G;
        bVar.K = pVar.new b(i, pVar.c, bVar);
        i.b bVar2 = i.this.l;
        Gf.m.o(bVar2.j != null);
        synchronized (bVar2.b) {
            Gf.m.n("Already allocated", !bVar2.f);
            bVar2.f = true;
        }
        bVar2.h();
        j1 j1Var = bVar2.c;
        j1Var.getClass();
        j1Var.a.a();
        if (bVar.I) {
            bVar.F.Y(bVar.L, bVar.y, i.this.o);
            for (C5.b bVar3 : i.this.j.a) {
                ((io.grpc.c) bVar3).z0();
            }
            bVar.y = null;
            C0219g c0219g = bVar.z;
            if (c0219g.b > 0) {
                bVar.G.a(bVar.A, bVar.K, c0219g, bVar.B);
            }
            bVar.I = false;
        }
        C0796E.b bVar4 = iVar.h.a;
        if ((bVar4 != C0796E.b.UNARY && bVar4 != C0796E.b.SERVER_STREAMING) || iVar.o) {
            this.i.flush();
        }
        int i2 = this.m;
        if (i2 < 2147483645) {
            this.m = i2 + 2;
        } else {
            this.m = IntCompanionObject.MAX_VALUE;
            t(IntCompanionObject.MAX_VALUE, EnumC0945a.NO_ERROR, C0801J.m.h("Stream ids exhausted"));
        }
    }

    public final void w() {
        if (this.v == null || !this.n.isEmpty() || !this.E.isEmpty() || this.y) {
            return;
        }
        this.y = true;
        C0898q0 c0898q0 = this.G;
        if (c0898q0 != null) {
            synchronized (c0898q0) {
                try {
                    C0898q0.e eVar = c0898q0.e;
                    C0898q0.e eVar2 = C0898q0.e.DISCONNECTED;
                    if (eVar != eVar2) {
                        c0898q0.e = eVar2;
                        ScheduledFuture<?> scheduledFuture = c0898q0.f;
                        if (scheduledFuture != null) {
                            scheduledFuture.cancel(false);
                        }
                        ScheduledFuture<?> scheduledFuture2 = c0898q0.g;
                        if (scheduledFuture2 != null) {
                            scheduledFuture2.cancel(false);
                            c0898q0.g = null;
                        }
                    }
                } catch (Throwable th) {
                    throw th;
                }
            }
        }
        C0874e0 c0874e0 = this.x;
        if (c0874e0 != null) {
            c0874e0.c(n());
            this.x = null;
        }
        if (!this.w) {
            this.w = true;
            this.i.T(EnumC0945a.NO_ERROR, new byte[0]);
        }
        this.i.close();
    }

    public class b implements Runnable {
        public final CountDownLatch a;
        public final C0930a b;

        public b(CountDownLatch countDownLatch, C0930a c0930a) {
            this.a = countDownLatch;
            this.b = c0930a;
        }

        @Override
        public final void run() {
            Socket j;
            SSLSession sSLSession;
            Socket socket;
            try {
                this.a.await();
            } catch (InterruptedException unused) {
                Thread.currentThread().interrupt();
            }
            H b = A.b(new a());
            try {
                try {
                    try {
                        j jVar = j.this;
                        C0826t c0826t = jVar.Q;
                        if (c0826t == null) {
                            j = jVar.A.createSocket(jVar.a.getAddress(), j.this.a.getPort());
                        } else {
                            SocketAddress socketAddress = c0826t.a;
                            if (!(socketAddress instanceof InetSocketAddress)) {
                                throw new StatusException(C0801J.l.h("Unsupported SocketAddress implementation " + j.this.Q.a.getClass()));
                            }
                            j = j.j(jVar, c0826t.b, (InetSocketAddress) socketAddress, c0826t.c, c0826t.f766d);
                        }
                        Socket socket2 = j;
                        j jVar2 = j.this;
                        SSLSocketFactory sSLSocketFactory = jVar2.B;
                        if (sSLSocketFactory != null) {
                            HostnameVerifier hostnameVerifier = jVar2.C;
                            String str = jVar2.b;
                            URI a2 = Y.a(str);
                            if (a2.getHost() != null) {
                                str = a2.getHost();
                            }
                            SSLSocket a3 = n.a(sSLSocketFactory, hostnameVerifier, socket2, str, j.this.m(), j.this.F);
                            sSLSession = a3.getSession();
                            socket = a3;
                        } else {
                            sSLSession = null;
                            socket = socket2;
                        }
                        socket.setTcpNoDelay(true);
                        H b2 = A.b(A.g(socket));
                        this.b.a(A.d(socket), socket);
                        j jVar3 = j.this;
                        io.grpc.a aVar = jVar3.u;
                        aVar.getClass();
                        a.C0087a c0087a = new a.C0087a(aVar);
                        c0087a.c(io.grpc.e.a, socket.getRemoteSocketAddress());
                        c0087a.c(io.grpc.e.b, socket.getLocalSocketAddress());
                        c0087a.c(io.grpc.e.c, sSLSession);
                        c0087a.c(X.a, sSLSession == null ? EnumC0800I.NONE : EnumC0800I.PRIVACY_AND_INTEGRITY);
                        jVar3.u = c0087a.a();
                        j jVar4 = j.this;
                        jVar4.t = jVar4.new d(jVar4.g.b(b2));
                        synchronized (j.this.k) {
                            try {
                                j.this.getClass();
                                if (sSLSession != null) {
                                    j jVar5 = j.this;
                                    new C0828v.a(sSLSession);
                                    jVar5.getClass();
                                }
                            } finally {
                            }
                        }
                    } catch (Exception e) {
                        j.this.a(e);
                        j jVar6 = j.this;
                        jVar6.t = jVar6.new d(jVar6.g.b(b));
                    }
                } catch (StatusException e2) {
                    j.this.t(0, EnumC0945a.INTERNAL_ERROR, e2.a);
                    j jVar7 = j.this;
                    jVar7.t = jVar7.new d(jVar7.g.b(b));
                }
            } catch (Throwable th) {
                j jVar8 = j.this;
                jVar8.t = jVar8.new d(jVar8.g.b(b));
                throw th;
            }
        }

        public class a implements N {
            @Override
            public final long read(C0219g c0219g, long j) {
                return -1L;
            }

            @Override
            public final O timeout() {
                return O.f306d;
            }

            @Override
            public final void close() {
            }
        }
    }
}