导航菜单

页面标题

页面副标题

Share Any v2.1.7 - f.java 源代码

正在查看: Share Any v2.1.7 应用的 f.java JAVA 源代码文件

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


package yd;

import be.g;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ThreadPoolExecutor;
import vd.c0;
import vd.h;
import vd.m;
import vd.n;
import vd.r;
import vd.t;
import yd.e;

public final class f {
    public final vd.a a;
    public e.a b;
    public c0 c;
    public final h d;
    public final vd.d e;
    public final n f;
    public final Object g;
    public final e h;
    public int i;
    public c j;
    public boolean k;
    public boolean l;
    public boolean m;
    public zd.c n;

    public static final class a extends WeakReference<f> {
        public final Object a;

        public a(f fVar, Object obj) {
            super(fVar);
            this.a = obj;
        }
    }

    public f(h hVar, vd.a aVar, vd.d dVar, n nVar, Object obj) {
        this.d = hVar;
        this.a = aVar;
        this.e = dVar;
        this.f = nVar;
        Objects.requireNonNull((t.a) wd.a.a);
        this.h = new e(aVar, hVar.e, dVar, nVar);
        this.g = obj;
    }

    public void a(c cVar, boolean z) {
        if (this.j != null) {
            throw new IllegalStateException();
        }
        this.j = cVar;
        this.k = z;
        cVar.n.add(new a(this, this.g));
    }

    public synchronized c b() {
        return this.j;
    }

    public final Socket c(boolean z, boolean z2, boolean z3) {
        Socket socket;
        if (z3) {
            this.n = null;
        }
        boolean z4 = true;
        if (z2) {
            this.l = true;
        }
        c cVar = this.j;
        if (cVar == null) {
            return null;
        }
        if (z) {
            cVar.k = true;
        }
        if (this.n != null) {
            return null;
        }
        if (!this.l && !cVar.k) {
            return null;
        }
        int size = cVar.n.size();
        for (int i = 0; i < size; i++) {
            if (cVar.n.get(i).get() == this) {
                cVar.n.remove(i);
                if (this.j.n.isEmpty()) {
                    this.j.o = System.nanoTime();
                    wd.a aVar = wd.a.a;
                    h hVar = this.d;
                    c cVar2 = this.j;
                    Objects.requireNonNull((t.a) aVar);
                    Objects.requireNonNull(hVar);
                    if (cVar2.k || hVar.a == 0) {
                        hVar.d.remove(cVar2);
                    } else {
                        hVar.notifyAll();
                        z4 = false;
                    }
                    if (z4) {
                        socket = this.j.e;
                        this.j = null;
                        return socket;
                    }
                }
                socket = null;
                this.j = null;
                return socket;
            }
        }
        throw new IllegalStateException();
    }

    public final c d(int i, int i2, int i3, int i4, boolean z) {
        c cVar;
        c0 c0Var;
        Socket c;
        c cVar2;
        boolean z2;
        boolean z3;
        Socket socket;
        e.a aVar;
        String str;
        int i5;
        boolean contains;
        synchronized (this.d) {
            if (this.l) {
                throw new IllegalStateException("released");
            }
            if (this.n != null) {
                throw new IllegalStateException("codec != null");
            }
            if (this.m) {
                throw new IOException("Canceled");
            }
            cVar = this.j;
            c0Var = null;
            c = (cVar == null || !cVar.k) ? null : c(false, false, true);
            c cVar3 = this.j;
            if (cVar3 != null) {
                cVar = null;
            } else {
                cVar3 = null;
            }
            if (!this.k) {
                cVar = null;
            }
            if (cVar3 == null) {
                wd.a.a.c(this.d, this.a, this, null);
                cVar2 = this.j;
                if (cVar2 != null) {
                    z2 = true;
                } else {
                    c0Var = this.c;
                }
            }
            cVar2 = cVar3;
            z2 = false;
        }
        wd.b.e(c);
        if (cVar != null) {
            Objects.requireNonNull(this.f);
        }
        if (z2) {
            Objects.requireNonNull(this.f);
        }
        if (cVar2 != null) {
            return cVar2;
        }
        if (c0Var != null || ((aVar = this.b) != null && aVar.a())) {
            z3 = false;
        } else {
            e eVar = this.h;
            if (!eVar.b()) {
                throw new NoSuchElementException();
            }
            ArrayList arrayList = new ArrayList();
            while (eVar.c()) {
                if (!eVar.c()) {
                    StringBuilder a2 = a.f.a("No route to ");
                    a2.append(eVar.a.a.d);
                    a2.append("; exhausted proxy configurations: ");
                    a2.append(eVar.d);
                    throw new SocketException(a2.toString());
                }
                List<Proxy> list = eVar.d;
                int i6 = eVar.e;
                eVar.e = i6 + 1;
                Proxy proxy = list.get(i6);
                eVar.f = new ArrayList();
                if (proxy.type() == Proxy.Type.DIRECT || proxy.type() == Proxy.Type.SOCKS) {
                    r rVar = eVar.a.a;
                    str = rVar.d;
                    i5 = rVar.e;
                } else {
                    SocketAddress address = proxy.address();
                    if (!(address instanceof InetSocketAddress)) {
                        StringBuilder a3 = a.f.a("Proxy.address() is not an InetSocketAddress: ");
                        a3.append(address.getClass());
                        throw new IllegalArgumentException(a3.toString());
                    }
                    InetSocketAddress inetSocketAddress = (InetSocketAddress) address;
                    InetAddress address2 = inetSocketAddress.getAddress();
                    str = address2 == null ? inetSocketAddress.getHostName() : address2.getHostAddress();
                    i5 = inetSocketAddress.getPort();
                }
                if (i5 < 1 || i5 > 65535) {
                    throw new SocketException("No route to " + str + ":" + i5 + "; port is out of range");
                }
                if (proxy.type() == Proxy.Type.SOCKS) {
                    eVar.f.add(InetSocketAddress.createUnresolved(str, i5));
                } else {
                    Objects.requireNonNull(eVar.c);
                    Objects.requireNonNull((m.a) eVar.a.b);
                    if (str == null) {
                        throw new UnknownHostException("hostname == null");
                    }
                    try {
                        List asList = Arrays.asList(InetAddress.getAllByName(str));
                        if (asList.isEmpty()) {
                            throw new UnknownHostException(eVar.a.b + " returned no addresses for " + str);
                        }
                        Objects.requireNonNull(eVar.c);
                        int size = asList.size();
                        for (int i7 = 0; i7 < size; i7++) {
                            eVar.f.add(new InetSocketAddress((InetAddress) asList.get(i7), i5));
                        }
                    } catch (NullPointerException e) {
                        UnknownHostException unknownHostException = new UnknownHostException(a.e.a("Broken system behaviour for dns lookup of ", str));
                        unknownHostException.initCause(e);
                        throw unknownHostException;
                    }
                }
                int size2 = eVar.f.size();
                for (int i8 = 0; i8 < size2; i8++) {
                    c0 c0Var2 = new c0(eVar.a, proxy, eVar.f.get(i8));
                    f3.c cVar4 = eVar.b;
                    synchronized (cVar4) {
                        contains = ((Set) cVar4.a).contains(c0Var2);
                    }
                    if (contains) {
                        eVar.g.add(c0Var2);
                    } else {
                        arrayList.add(c0Var2);
                    }
                }
                if (!arrayList.isEmpty()) {
                    break;
                }
            }
            if (arrayList.isEmpty()) {
                arrayList.addAll(eVar.g);
                eVar.g.clear();
            }
            this.b = new e.a(arrayList);
            z3 = true;
        }
        synchronized (this.d) {
            if (this.m) {
                throw new IOException("Canceled");
            }
            if (z3) {
                e.a aVar2 = this.b;
                Objects.requireNonNull(aVar2);
                ArrayList arrayList2 = new ArrayList(aVar2.a);
                int size3 = arrayList2.size();
                int i9 = 0;
                while (true) {
                    if (i9 >= size3) {
                        break;
                    }
                    c0 c0Var3 = (c0) arrayList2.get(i9);
                    wd.a.a.c(this.d, this.a, this, c0Var3);
                    c cVar5 = this.j;
                    if (cVar5 != null) {
                        this.c = c0Var3;
                        z2 = true;
                        cVar2 = cVar5;
                        break;
                    }
                    i9++;
                }
            }
            if (!z2) {
                if (c0Var == null) {
                    e.a aVar3 = this.b;
                    if (!aVar3.a()) {
                        throw new NoSuchElementException();
                    }
                    List<c0> list2 = aVar3.a;
                    int i10 = aVar3.b;
                    aVar3.b = i10 + 1;
                    c0Var = list2.get(i10);
                }
                this.c = c0Var;
                this.i = 0;
                cVar2 = new c(this.d, c0Var);
                a(cVar2, false);
            }
        }
        if (!z2) {
            cVar2.c(i, i2, i3, i4, z, this.e, this.f);
            wd.a aVar4 = wd.a.a;
            h hVar = this.d;
            Objects.requireNonNull((t.a) aVar4);
            hVar.e.e(cVar2.c);
            synchronized (this.d) {
                this.k = true;
                wd.a aVar5 = wd.a.a;
                h hVar2 = this.d;
                Objects.requireNonNull((t.a) aVar5);
                if (!hVar2.f) {
                    hVar2.f = true;
                    ((ThreadPoolExecutor) h.g).execute(hVar2.c);
                }
                hVar2.d.add(cVar2);
                if (cVar2.h()) {
                    socket = wd.a.a.b(this.d, this.a, this);
                    cVar2 = this.j;
                } else {
                    socket = null;
                }
            }
            wd.b.e(socket);
        }
        Objects.requireNonNull(this.f);
        return cVar2;
    }

    public final c e(int i, int i2, int i3, int i4, boolean z, boolean z2) {
        boolean z3;
        while (true) {
            c d = d(i, i2, i3, i4, z);
            synchronized (this.d) {
                if (d.l == 0) {
                    return d;
                }
                boolean z4 = false;
                if (!d.e.isClosed() && !d.e.isInputShutdown() && !d.e.isOutputShutdown()) {
                    g gVar = d.h;
                    if (gVar != null) {
                        synchronized (gVar) {
                            z3 = gVar.k;
                        }
                        z4 = !z3;
                    } else {
                        if (z2) {
                            try {
                                int soTimeout = d.e.getSoTimeout();
                                try {
                                    d.e.setSoTimeout(1);
                                    if (d.i.m()) {
                                        d.e.setSoTimeout(soTimeout);
                                    } else {
                                        d.e.setSoTimeout(soTimeout);
                                    }
                                } catch (Throwable th) {
                                    d.e.setSoTimeout(soTimeout);
                                    throw th;
                                }
                            } catch (SocketTimeoutException unused) {
                            } catch (IOException unused2) {
                            }
                        }
                        z4 = true;
                    }
                }
                if (z4) {
                    return d;
                }
                f();
            }
        }
    }

    public void f() {
        c cVar;
        Socket c;
        synchronized (this.d) {
            cVar = this.j;
            c = c(true, false, false);
            if (this.j != null) {
                cVar = null;
            }
        }
        wd.b.e(c);
        if (cVar != null) {
            Objects.requireNonNull(this.f);
        }
    }

    public void g() {
        c cVar;
        Socket c;
        synchronized (this.d) {
            cVar = this.j;
            c = c(false, true, false);
            if (this.j != null) {
                cVar = null;
            }
        }
        wd.b.e(c);
        if (cVar != null) {
            Objects.requireNonNull(this.f);
        }
    }

    public void h(java.io.IOException r7) {
        throw new UnsupportedOperationException("Method not decompiled: yd.f.h(java.io.IOException):void");
    }

    public void i(boolean z, zd.c cVar, long j, IOException iOException) {
        c cVar2;
        Socket c;
        boolean z2;
        Objects.requireNonNull(this.f);
        synchronized (this.d) {
            if (cVar != null) {
                if (cVar == this.n) {
                    if (!z) {
                        this.j.l++;
                    }
                    cVar2 = this.j;
                    c = c(z, false, true);
                    if (this.j != null) {
                        cVar2 = null;
                    }
                    z2 = this.l;
                }
            }
            throw new IllegalStateException("expected " + this.n + " but was " + cVar);
        }
        wd.b.e(c);
        if (cVar2 != null) {
            Objects.requireNonNull(this.f);
        }
        if (iOException == null && !z2) {
            return;
        }
        Objects.requireNonNull(this.f);
    }

    public String toString() {
        c b = b();
        return b != null ? b.toString() : this.a.toString();
    }
}