射射AV v6.8.3版本的 MD5 值为:4b0475341d3c62fa7e762c41558fd25f
以下内容为反编译后的 f.java 源代码,内容仅作参考
package com.cloudtech.a;
import android.content.Context;
import android.net.Uri;
import com.cloudtech.ads.utils.Utils;
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;
public class f {
private static volatile f f3629i;
private final Object a;
private final ExecutorService b;
private final Map<String, g> c;
private final ServerSocket f3630d;
private final int f3631e;
private final Thread f3632f;
private final com.cloudtech.a.c f3633g;
private final l f3634h;
public static final class a {
private File a;
private com.cloudtech.a.c.c f3635d;
private com.cloudtech.a.a.a c = new com.cloudtech.a.a.h(52428800);
private com.cloudtech.a.a.c b = new com.cloudtech.a.a.f();
private com.cloudtech.a.b.b f3636e = new com.cloudtech.a.b.a();
public a(Context context) {
this.f3635d = com.cloudtech.a.c.d.a(context);
this.a = s.a(context);
}
public a a(File file) {
this.a = (File) m.a(file);
return this;
}
public a a(int i2) {
this.c = new com.cloudtech.a.a.g(i2);
return this;
}
public com.cloudtech.a.c a() {
return new com.cloudtech.a.c(this.a, this.b, this.c, this.f3635d, this.f3636e);
}
}
public final class b implements Runnable {
private final Socket a;
public b(Socket socket) {
this.a = socket;
}
@Override
public void run() {
f.this.a(this.a);
}
}
private final class c implements Runnable {
private final CountDownLatch a;
public c(CountDownLatch countDownLatch) {
this.a = countDownLatch;
}
@Override
public void run() {
this.a.countDown();
f.this.b();
}
}
private f(Context context) {
this(new a(context).a(Utils.getVideoCacheDir(context)).a(5).a());
}
private String c(String str) {
return String.format(Locale.US, "http://%s:%d/%s", "127.0.0.1", Integer.valueOf(this.f3631e), p.b(str));
}
private File d(String str) {
com.cloudtech.a.c cVar = this.f3633g;
return new File(cVar.a, cVar.b.a(str));
}
private g e(String str) {
g gVar;
synchronized (this.a) {
gVar = this.c.get(str);
if (gVar == null) {
gVar = new g(str, this.f3633g);
this.c.put(str, gVar);
}
}
return gVar;
}
public boolean b(String str) {
m.a(str, "Url can't be null!");
return d(str).exists();
}
public static f a(Context context) {
f fVar = f3629i;
if (fVar == null) {
synchronized (f.class) {
fVar = f3629i;
if (fVar == null) {
fVar = new f(context);
f3629i = fVar;
}
}
}
return fVar;
}
public void b() {
while (!Thread.currentThread().isInterrupted()) {
try {
Socket accept = this.f3630d.accept();
i.c("Accept new socket " + accept);
this.b.submit(new b(accept));
} catch (IOException e2) {
a(new o("Error during waiting connection", e2));
return;
}
}
}
private int c() {
int i2;
synchronized (this.a) {
i2 = 0;
Iterator<g> it = this.c.values().iterator();
while (it.hasNext()) {
i2 += it.next().a();
}
}
return i2;
}
private void d(Socket socket) {
try {
if (socket.isOutputShutdown()) {
return;
}
socket.shutdownOutput();
} catch (IOException e2) {
i.b(String.format("Failed to close socket on proxy side: %s. It seems client have already closed connection.", e2.getMessage()));
}
}
private f(com.cloudtech.a.c cVar) {
this.a = new Object();
this.b = Executors.newFixedThreadPool(8);
this.c = new ConcurrentHashMap();
this.f3633g = (com.cloudtech.a.c) m.a(cVar);
try {
ServerSocket serverSocket = new ServerSocket(0, 8, InetAddress.getByName("127.0.0.1"));
this.f3630d = serverSocket;
int localPort = serverSocket.getLocalPort();
this.f3631e = localPort;
j.a("127.0.0.1", localPort);
CountDownLatch countDownLatch = new CountDownLatch(1);
Thread thread = new Thread(new c(countDownLatch));
this.f3632f = thread;
thread.start();
countDownLatch.await();
this.f3634h = new l("127.0.0.1", localPort);
i.a((Object) ("Proxy cache server started. Is it alive? " + a()));
} catch (IOException | InterruptedException e2) {
this.b.shutdown();
throw new IllegalStateException("Error starting local proxy server", e2);
}
}
private void e(Socket socket) {
try {
if (socket.isClosed()) {
return;
}
socket.close();
} catch (IOException e2) {
a(new o("Error closing socket", e2));
}
}
private void b(Socket socket) {
c(socket);
d(socket);
e(socket);
}
private void c(Socket socket) {
try {
if (socket.isInputShutdown()) {
return;
}
socket.shutdownInput();
} catch (SocketException unused) {
i.c("Releasing input stream… Socket is closed by client.");
} catch (IOException e2) {
a(new o("Error closing socket input stream", e2));
}
}
public String a(String str) {
return a(str, true);
}
public String a(String str, boolean z) {
if (!z || !b(str)) {
return a() ? c(str) : str;
}
File d2 = d(str);
a(d2);
return Uri.fromFile(d2).toString();
}
private boolean a() {
return this.f3634h.c(3, 70);
}
private void a(File file) {
try {
this.f3633g.c.a(file);
} catch (IOException e2) {
i.a("Error touching file " + file, e2);
}
}
public void a(Socket socket) {
StringBuilder sb;
try {
try {
d b2 = d.b(socket.getInputStream());
i.c("Request to cache proxy:" + b2);
String c2 = p.c(b2.a);
if (this.f3634h.e(c2)) {
this.f3634h.a(socket);
} else {
e(c2).c(b2, socket);
}
b(socket);
sb = new StringBuilder();
} catch (o e2) {
e = e2;
a(new o("Error processing request", e));
b(socket);
sb = new StringBuilder();
} catch (SocketException unused) {
i.c("Closing socket… Socket is closed by client.");
b(socket);
sb = new StringBuilder();
} catch (IOException e3) {
e = e3;
a(new o("Error processing request", e));
b(socket);
sb = new StringBuilder();
}
sb.append("Opened connections: ");
sb.append(c());
i.c(sb.toString());
} catch (Throwable th) {
b(socket);
i.c("Opened connections: " + c());
throw th;
}
}
private void a(Throwable th) {
i.a("HttpProxyCacheServer error", th);
}
}