鑫垚影视 v20.42版本的 MD5 值为:e3822d25ef47121f1770bb4806abacfe
以下内容为反编译后的 i.java 源代码,内容仅作参考
package e.e.a;
import android.content.Context;
import android.net.Uri;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketException;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.TrustManager;
public class i {
private static final String f12385i = "127.0.0.1";
private final Object f12386a;
private final ExecutorService f12387b;
private final Map<String, j> f12388c;
private final ServerSocket f12389d;
private final int f12390e;
private final Thread f12391f;
private final e f12392g;
private final n f12393h;
public static final class b {
private static final long f12394h = 536870912;
private File f12395a;
private final e.e.a.x.c f12398d;
private HostnameVerifier f12400f;
private TrustManager[] f12401g;
private e.e.a.v.a f12397c = new e.e.a.v.h(536870912);
private e.e.a.v.c f12396b = new e.e.a.v.f();
private e.e.a.w.b f12399e = new e.e.a.w.a();
public b(Context context) {
this.f12398d = e.e.a.x.d.b(context);
this.f12395a = u.c(context);
}
public e c() {
return new e(this.f12395a, this.f12396b, this.f12397c, this.f12398d, this.f12399e, this.f12400f, this.f12401g);
}
public i b() {
return new i(c());
}
public b d(File file) {
this.f12395a = (File) o.d(file);
return this;
}
public b e(e.e.a.v.a aVar) {
this.f12397c = (e.e.a.v.a) o.d(aVar);
return this;
}
public b f(e.e.a.v.c cVar) {
this.f12396b = (e.e.a.v.c) o.d(cVar);
return this;
}
public b g(e.e.a.w.b bVar) {
this.f12399e = (e.e.a.w.b) o.d(bVar);
return this;
}
public b h(HostnameVerifier hostnameVerifier) {
this.f12400f = hostnameVerifier;
return this;
}
public b i(int i2) {
this.f12397c = new e.e.a.v.g(i2);
return this;
}
public b j(long j2) {
this.f12397c = new e.e.a.v.h(j2);
return this;
}
public b k(TrustManager[] trustManagerArr) {
this.f12401g = trustManagerArr;
return this;
}
}
public final class c implements Runnable {
private final Socket f12402a;
public c(Socket socket) {
this.f12402a = socket;
}
@Override
public void run() {
i.this.o(this.f12402a);
}
}
public final class d implements Runnable {
private final CountDownLatch f12404a;
public d(CountDownLatch countDownLatch) {
this.f12404a = countDownLatch;
}
@Override
public void run() {
this.f12404a.countDown();
i.this.w();
}
}
private String c(String str) {
return String.format(Locale.US, "http://%s:%d/%s", f12385i, Integer.valueOf(this.f12390e), r.f(str));
}
private void d(Socket socket) {
try {
if (socket.isClosed()) {
return;
}
socket.close();
} catch (IOException unused) {
}
}
private void e(Socket socket) {
try {
if (socket.isInputShutdown()) {
return;
}
socket.shutdownInput();
} catch (SocketException | IOException unused) {
}
}
private void f(Socket socket) {
try {
if (socket.isOutputShutdown()) {
return;
}
socket.shutdownOutput();
} catch (IOException e2) {
h.k("Failed to close socket on proxy side: {}. It seems client have already closed connection.", e2.getMessage());
}
}
private File g(String str) {
e eVar = this.f12392g;
return new File(eVar.f12367a, eVar.f12368b.a(str));
}
private j h(String str) throws q {
j jVar;
synchronized (this.f12386a) {
jVar = this.f12388c.get(str);
if (jVar == null) {
jVar = new j(str, this.f12392g);
this.f12388c.put(str, jVar);
}
}
return jVar;
}
private int i() {
int i2;
synchronized (this.f12386a) {
i2 = 0;
Iterator<j> it = this.f12388c.values().iterator();
while (it.hasNext()) {
i2 += it.next().b();
}
}
return i2;
}
private boolean l() {
return this.f12393h.e(3, 70);
}
private void n(Throwable th) {
h.g("HttpProxyCacheServer error", th.getMessage());
}
public void o(Socket socket) {
StringBuilder sb;
try {
try {
f c2 = f.c(socket.getInputStream());
String e2 = r.e(c2.f12376a);
if (this.f12393h.d(e2)) {
this.f12393h.g(socket);
} else {
h(e2).d(c2, socket);
}
q(socket);
sb = new StringBuilder();
} catch (Throwable th) {
q(socket);
h.h("Opened connections: " + i());
throw th;
}
} catch (q e3) {
e = e3;
n(new q("Error processing request", e));
q(socket);
sb = new StringBuilder();
} catch (SocketException unused) {
q(socket);
sb = new StringBuilder();
} catch (IOException e4) {
e = e4;
n(new q("Error processing request", e));
q(socket);
sb = new StringBuilder();
}
sb.append("Opened connections: ");
sb.append(i());
h.h(sb.toString());
}
private void q(Socket socket) {
e(socket);
f(socket);
d(socket);
}
private void s() {
synchronized (this.f12386a) {
Iterator<j> it = this.f12388c.values().iterator();
while (it.hasNext()) {
it.next().f();
}
this.f12388c.clear();
}
}
private void t(File file) {
try {
this.f12392g.f12369c.a(file);
} catch (IOException e2) {
h.f("Error touching file " + file, e2);
}
}
public void w() {
while (!Thread.currentThread().isInterrupted()) {
try {
this.f12387b.submit(new c(this.f12389d.accept()));
} catch (IOException e2) {
n(new q("Error during waiting connection", e2));
return;
}
}
}
public String j(String str) {
return k(str, true);
}
public String k(String str, boolean z) {
if (!z || !m(str)) {
return l() ? c(str) : str;
}
File g2 = g(str);
t(g2);
return Uri.fromFile(g2).toString();
}
public boolean m(String str) {
o.e(str, "Url can't be null!");
return g(str).exists();
}
public void p(e.e.a.d dVar, String str) {
o.a(dVar, str);
synchronized (this.f12386a) {
try {
h(str).e(dVar);
} catch (q e2) {
h.k("Error registering cache listener", e2.getMessage());
}
}
}
public void r() {
h.h("Shutdown proxy server");
s();
this.f12392g.f12370d.release();
this.f12391f.interrupt();
try {
if (this.f12389d.isClosed()) {
return;
}
this.f12389d.close();
} catch (IOException e2) {
n(new q("Error shutting down proxy server", e2));
}
}
public void u(e.e.a.d dVar) {
o.d(dVar);
synchronized (this.f12386a) {
Iterator<j> it = this.f12388c.values().iterator();
while (it.hasNext()) {
it.next().h(dVar);
}
}
}
public void v(e.e.a.d dVar, String str) {
o.a(dVar, str);
synchronized (this.f12386a) {
try {
h(str).h(dVar);
} catch (q e2) {
h.k("Error registering cache listener", e2.getMessage());
}
}
}
public i(Context context) {
this(new b(context).c());
}
private i(e eVar) {
this.f12386a = new Object();
this.f12387b = Executors.newFixedThreadPool(8);
this.f12388c = new ConcurrentHashMap();
this.f12392g = (e) o.d(eVar);
try {
ServerSocket serverSocket = new ServerSocket(0, 8, InetAddress.getByName(f12385i));
this.f12389d = serverSocket;
int localPort = serverSocket.getLocalPort();
this.f12390e = localPort;
l.a(f12385i, localPort);
CountDownLatch countDownLatch = new CountDownLatch(1);
Thread thread = new Thread(new d(countDownLatch));
this.f12391f = thread;
thread.start();
countDownLatch.await();
this.f12393h = new n(f12385i, localPort);
h.h("Proxy cache server started. Is it alive? " + l());
} catch (IOException | InterruptedException e2) {
this.f12387b.shutdown();
throw new IllegalStateException("Error starting local proxy server", e2);
}
}
}