a.smali

.class public Lcom/fulishe/fs/newvideo/cache/a;
.super Ljava/lang/Object;
.source ""


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/fulishe/fs/newvideo/cache/a$c;,
        Lcom/fulishe/fs/newvideo/cache/a$b;,
        Lcom/fulishe/fs/newvideo/cache/a$a;
    }
.end annotation


# instance fields
.field public final a:Ljava/lang/Object;

.field public final b:Ljava/util/concurrent/ExecutorService;

.field public final c:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Lcom/fulishe/fs/newvideo/cache/f;",
            ">;"
        }
    .end annotation
.end field

.field public final d:Ljava/net/ServerSocket;

.field public final e:I

.field public final f:Ljava/lang/Thread;

.field public final g:Lcom/fulishe/fs/newvideo/cache/e;

.field public final h:Lcom/fulishe/fs/newvideo/cache/l;

.field public i:I


# direct methods
.method public constructor <init>(Lcom/fulishe/fs/newvideo/cache/e;)V
    .registers 6

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->a:Ljava/lang/Object;

    const/4 v0, 0x4

    invoke-static {v0}, Ljava/util/concurrent/Executors;->newFixedThreadPool(I)Ljava/util/concurrent/ExecutorService;

    move-result-object v0

    iput-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->b:Ljava/util/concurrent/ExecutorService;

    new-instance v0, Ljava/util/concurrent/ConcurrentHashMap;

    invoke-direct {v0}, Ljava/util/concurrent/ConcurrentHashMap;-><init>()V

    iput-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->c:Ljava/util/Map;

    const v0, 0x32000

    iput v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->i:I

    invoke-static {p1}, Lcom/fulishe/fs/newvideo/cache/o;->a(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/fulishe/fs/newvideo/cache/e;

    iput-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->g:Lcom/fulishe/fs/newvideo/cache/e;

    :try_start_25
    new-instance v0, Ljava/net/ServerSocket;

    const/4 v1, 0x0

    const/16 v2, 0x8

    const-string v3, "127.0.0.1"

    invoke-static {v3}, Ljava/net/InetAddress;->getByName(Ljava/lang/String;)Ljava/net/InetAddress;

    move-result-object v3

    invoke-direct {v0, v1, v2, v3}, Ljava/net/ServerSocket;-><init>(IILjava/net/InetAddress;)V

    iput-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->d:Ljava/net/ServerSocket;

    invoke-virtual {v0}, Ljava/net/ServerSocket;->getLocalPort()I

    move-result v0

    iput v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->e:I
    :try_end_3b
    .catch Ljava/io/IOException; {:try_start_25 .. :try_end_3b} :catch_72
    .catch Ljava/lang/InterruptedException; {:try_start_25 .. :try_end_3b} :catch_64

    const-string v1, "127.0.0.1"

    :try_start_3d
    invoke-static {v1, v0}, Lcom/fulishe/fs/newvideo/cache/k;->a(Ljava/lang/String;I)V

    new-instance v0, Ljava/util/concurrent/CountDownLatch;

    const/4 v1, 0x1

    invoke-direct {v0, v1}, Ljava/util/concurrent/CountDownLatch;-><init>(I)V

    new-instance v1, Ljava/lang/Thread;

    new-instance v2, Lcom/fulishe/fs/newvideo/cache/a$c;

    invoke-direct {v2, p0, v0}, Lcom/fulishe/fs/newvideo/cache/a$c;-><init>(Lcom/fulishe/fs/newvideo/cache/a;Ljava/util/concurrent/CountDownLatch;)V

    invoke-direct {v1, v2}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;)V

    iput-object v1, p0, Lcom/fulishe/fs/newvideo/cache/a;->f:Ljava/lang/Thread;

    invoke-virtual {v1}, Ljava/lang/Thread;->start()V

    invoke-virtual {v0}, Ljava/util/concurrent/CountDownLatch;->await()V

    new-instance v0, Lcom/fulishe/fs/newvideo/cache/l;
    :try_end_5a
    .catch Ljava/io/IOException; {:try_start_3d .. :try_end_5a} :catch_72
    .catch Ljava/lang/InterruptedException; {:try_start_3d .. :try_end_5a} :catch_64

    const-string v1, "127.0.0.1"

    :try_start_5c
    iget v2, p0, Lcom/fulishe/fs/newvideo/cache/a;->e:I

    invoke-direct {v0, v1, v2}, Lcom/fulishe/fs/newvideo/cache/l;-><init>(Ljava/lang/String;I)V

    iput-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->h:Lcom/fulishe/fs/newvideo/cache/l;
    :try_end_63
    .catch Ljava/io/IOException; {:try_start_5c .. :try_end_63} :catch_72
    .catch Ljava/lang/InterruptedException; {:try_start_5c .. :try_end_63} :catch_64

    return-void

    :catch_64
    move-exception v0

    iget-object v1, p0, Lcom/fulishe/fs/newvideo/cache/a;->b:Ljava/util/concurrent/ExecutorService;

    invoke-interface {v1}, Ljava/util/concurrent/ExecutorService;->shutdown()V

    new-instance v1, Ljava/lang/IllegalStateException;

    const-string v2, "Error starting local proxy server"

    invoke-direct {v1, v2, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1

    :catch_72
    move-exception v0

    iget-object v1, p0, Lcom/fulishe/fs/newvideo/cache/a;->b:Ljava/util/concurrent/ExecutorService;

    invoke-interface {v1}, Ljava/util/concurrent/ExecutorService;->shutdown()V

    new-instance v1, Ljava/lang/IllegalStateException;

    const-string v2, "Error starting local proxy server"

    invoke-direct {v1, v2, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    throw v1
.end method

.method public synthetic constructor <init>(Lcom/fulishe/fs/newvideo/cache/e;Lcom/fulishe/fs/newvideo/cache/b;)V
    .registers 3

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;-><init>(Lcom/fulishe/fs/newvideo/cache/e;)V

    return-void
.end method

.method public static synthetic a(Lcom/fulishe/fs/newvideo/cache/a;)V
    .registers 1

    invoke-direct {p0}, Lcom/fulishe/fs/newvideo/cache/a;->b()V

    return-void
.end method

.method public static synthetic a(Lcom/fulishe/fs/newvideo/cache/a;Ljava/net/Socket;)V
    .registers 2

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->a(Ljava/net/Socket;)V

    return-void
.end method

.method private a(Ljava/io/File;)V
    .registers 5

    :try_start_0
    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->g:Lcom/fulishe/fs/newvideo/cache/e;

    iget-object v0, v0, Lcom/fulishe/fs/newvideo/cache/e;->c:Lcom/fulishe/fs/newvideo/cache/a/a;

    invoke-interface {v0, p1}, Lcom/fulishe/fs/newvideo/cache/a/a;->a(Ljava/io/File;)V
    :try_end_7
    .catchall {:try_start_0 .. :try_end_7} :catchall_8

    :goto_7
    return-void

    :catchall_8
    move-exception v0

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Error touching file "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    const-string v2, "HttpProxyCacheServer"

    invoke-static {v2, v1, v0}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    goto :goto_7
.end method

.method private a(Ljava/lang/Throwable;)V
    .registers 4

    const-string v0, "HttpProxyCacheServer"

    const-string v1, "HttpProxyCacheServer error"

    invoke-static {v0, v1, p1}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V

    return-void
.end method

.method private a(Ljava/net/Socket;)V
    .registers 6

    :try_start_0
    invoke-virtual {p1}, Ljava/net/Socket;->getInputStream()Ljava/io/InputStream;

    move-result-object v0

    invoke-static {v0}, Lcom/fulishe/fs/newvideo/cache/g;->a(Ljava/io/InputStream;)Lcom/fulishe/fs/newvideo/cache/g;
    :try_end_7
    .catch Ljava/net/SocketException; {:try_start_0 .. :try_end_7} :catch_5b
    .catch Lcom/fulishe/fs/newvideo/cache/m; {:try_start_0 .. :try_end_7} :catch_ae
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_7} :catch_83
    .catchall {:try_start_0 .. :try_end_7} :catchall_da

    move-result-object v0

    const-string v1, "HttpProxyCacheServer"

    :try_start_a
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Request to cache proxy:"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v1, v0, Lcom/fulishe/fs/newvideo/cache/g;->c:Ljava/lang/String;

    invoke-static {v1}, Lcom/fulishe/fs/newvideo/cache/q;->c(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    iget-object v2, p0, Lcom/fulishe/fs/newvideo/cache/a;->h:Lcom/fulishe/fs/newvideo/cache/l;

    invoke-virtual {v2, v1}, Lcom/fulishe/fs/newvideo/cache/l;->a(Ljava/lang/String;)Z

    move-result v2

    if-eqz v2, :cond_53

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->h:Lcom/fulishe/fs/newvideo/cache/l;

    invoke-virtual {v0, p1}, Lcom/fulishe/fs/newvideo/cache/l;->a(Ljava/net/Socket;)V
    :try_end_33
    .catch Ljava/net/SocketException; {:try_start_a .. :try_end_33} :catch_5b
    .catch Lcom/fulishe/fs/newvideo/cache/m; {:try_start_a .. :try_end_33} :catch_ae
    .catch Ljava/io/IOException; {:try_start_a .. :try_end_33} :catch_83
    .catchall {:try_start_a .. :try_end_33} :catchall_da

    :goto_33
    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->b(Ljava/net/Socket;)V

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Opened connections: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-direct {p0}, Lcom/fulishe/fs/newvideo/cache/a;->c()I

    move-result v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "HttpProxyCacheServer"

    invoke-static {v1, v0}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V

    :goto_52
    return-void

    :cond_53
    :try_start_53
    invoke-direct {p0, v1}, Lcom/fulishe/fs/newvideo/cache/a;->g(Ljava/lang/String;)Lcom/fulishe/fs/newvideo/cache/f;

    move-result-object v1

    invoke-virtual {v1, v0, p1}, Lcom/fulishe/fs/newvideo/cache/f;->a(Lcom/fulishe/fs/newvideo/cache/g;Ljava/net/Socket;)V
    :try_end_5a
    .catch Ljava/net/SocketException; {:try_start_53 .. :try_end_5a} :catch_5b
    .catch Lcom/fulishe/fs/newvideo/cache/m; {:try_start_53 .. :try_end_5a} :catch_ae
    .catch Ljava/io/IOException; {:try_start_53 .. :try_end_5a} :catch_83
    .catchall {:try_start_53 .. :try_end_5a} :catchall_da

    goto :goto_33

    :catch_5b
    move-exception v0

    :try_start_5c
    const-string v0, "HttpProxyCacheServer"

    const-string v1, "Closing socket\u2026 Socket is closed by client."

    invoke-static {v0, v1}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V
    :try_end_63
    .catchall {:try_start_5c .. :try_end_63} :catchall_da

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->b(Ljava/net/Socket;)V

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Opened connections: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-direct {p0}, Lcom/fulishe/fs/newvideo/cache/a;->c()I

    move-result v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "HttpProxyCacheServer"

    invoke-static {v1, v0}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_52

    :catch_83
    move-exception v0

    :try_start_84
    new-instance v1, Lcom/fulishe/fs/newvideo/cache/m;

    const-string v2, "Error processing request"

    invoke-direct {v1, v2, v0}, Lcom/fulishe/fs/newvideo/cache/m;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    invoke-direct {p0, v1}, Lcom/fulishe/fs/newvideo/cache/a;->a(Ljava/lang/Throwable;)V
    :try_end_8e
    .catchall {:try_start_84 .. :try_end_8e} :catchall_da

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->b(Ljava/net/Socket;)V

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Opened connections: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-direct {p0}, Lcom/fulishe/fs/newvideo/cache/a;->c()I

    move-result v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "HttpProxyCacheServer"

    invoke-static {v1, v0}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_52

    :catch_ae
    move-exception v0

    :try_start_af
    new-instance v1, Lcom/fulishe/fs/newvideo/cache/m;

    const-string v2, "Error processing request"

    invoke-direct {v1, v2, v0}, Lcom/fulishe/fs/newvideo/cache/m;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    invoke-direct {p0, v1}, Lcom/fulishe/fs/newvideo/cache/a;->a(Ljava/lang/Throwable;)V
    :try_end_b9
    .catchall {:try_start_af .. :try_end_b9} :catchall_da

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->b(Ljava/net/Socket;)V

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    const-string v1, "Opened connections: "

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-direct {p0}, Lcom/fulishe/fs/newvideo/cache/a;->c()I

    move-result v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "HttpProxyCacheServer"

    invoke-static {v1, v0}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V

    goto/16 :goto_52

    :catchall_da
    move-exception v0

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->b(Ljava/net/Socket;)V

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Opened connections: "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-direct {p0}, Lcom/fulishe/fs/newvideo/cache/a;->c()I

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    const-string v2, "HttpProxyCacheServer"

    invoke-static {v2, v1}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V

    throw v0
.end method

.method private a()Z
    .registers 4

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->h:Lcom/fulishe/fs/newvideo/cache/l;

    const/4 v1, 0x3

    const/16 v2, 0x46

    invoke-virtual {v0, v1, v2}, Lcom/fulishe/fs/newvideo/cache/l;->a(II)Z

    move-result v0

    return v0
.end method

.method private b(Ljava/lang/String;I)Ljava/lang/String;
    .registers 5

    if-eqz p1, :cond_28

    const-string v0, "?"

    invoke-virtual {p1, v0}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z

    move-result v0

    if-nez v0, :cond_28

    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "?size="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "&preload=true&hasPrefix=false"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    :goto_27
    return-object v0

    :cond_28
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "&size="

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0, p2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "&preload=true&hasPrefix=true"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    goto :goto_27
.end method

.method private b()V
    .registers 5

    :goto_0
    invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/Thread;->isInterrupted()Z

    move-result v0

    if-nez v0, :cond_3e

    :try_start_a
    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->d:Ljava/net/ServerSocket;

    invoke-virtual {v0}, Ljava/net/ServerSocket;->accept()Ljava/net/Socket;
    :try_end_f
    .catchall {:try_start_a .. :try_end_f} :catchall_33

    move-result-object v0

    const-string v1, "HttpProxyCacheServer"

    :try_start_12
    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    const-string v3, "Accept new socket "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v1, p0, Lcom/fulishe/fs/newvideo/cache/a;->b:Ljava/util/concurrent/ExecutorService;

    new-instance v2, Lcom/fulishe/fs/newvideo/cache/a$b;

    invoke-direct {v2, p0, v0}, Lcom/fulishe/fs/newvideo/cache/a$b;-><init>(Lcom/fulishe/fs/newvideo/cache/a;Ljava/net/Socket;)V

    invoke-interface {v1, v2}, Ljava/util/concurrent/ExecutorService;->submit(Ljava/lang/Runnable;)Ljava/util/concurrent/Future;
    :try_end_32
    .catchall {:try_start_12 .. :try_end_32} :catchall_33

    goto :goto_0

    :catchall_33
    move-exception v0

    new-instance v1, Lcom/fulishe/fs/newvideo/cache/m;

    const-string v2, "Error during waiting connection"

    invoke-direct {v1, v2, v0}, Lcom/fulishe/fs/newvideo/cache/m;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    invoke-direct {p0, v1}, Lcom/fulishe/fs/newvideo/cache/a;->a(Ljava/lang/Throwable;)V

    :cond_3e
    return-void
.end method

.method private b(Ljava/net/Socket;)V
    .registers 2

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->c(Ljava/net/Socket;)V

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->d(Ljava/net/Socket;)V

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->e(Ljava/net/Socket;)V

    return-void
.end method

.method private c()I
    .registers 5

    iget-object v2, p0, Lcom/fulishe/fs/newvideo/cache/a;->a:Ljava/lang/Object;

    monitor-enter v2

    const/4 v0, 0x0

    :try_start_4
    iget-object v1, p0, Lcom/fulishe/fs/newvideo/cache/a;->c:Ljava/util/Map;

    invoke-interface {v1}, Ljava/util/Map;->values()Ljava/util/Collection;

    move-result-object v1

    invoke-interface {v1}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object v3

    move v1, v0

    :goto_f
    invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_22

    invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/fulishe/fs/newvideo/cache/f;

    invoke-virtual {v0}, Lcom/fulishe/fs/newvideo/cache/f;->c()I

    move-result v0

    add-int/2addr v0, v1

    move v1, v0

    goto :goto_f

    :cond_22
    monitor-exit v2

    return v1

    :catchall_24
    move-exception v0

    monitor-exit v2
    :try_end_26
    .catchall {:try_start_4 .. :try_end_26} :catchall_24

    throw v0
.end method

.method private c(Ljava/net/Socket;)V
    .registers 5

    :try_start_0
    invoke-virtual {p1}, Ljava/net/Socket;->isInputShutdown()Z

    move-result v0

    if-nez v0, :cond_9

    invoke-virtual {p1}, Ljava/net/Socket;->shutdownInput()V
    :try_end_9
    .catch Ljava/net/SocketException; {:try_start_0 .. :try_end_9} :catch_16
    .catchall {:try_start_0 .. :try_end_9} :catchall_a

    :cond_9
    :goto_9
    return-void

    :catchall_a
    move-exception v0

    new-instance v1, Lcom/fulishe/fs/newvideo/cache/m;

    const-string v2, "Error closing socket input stream"

    invoke-direct {v1, v2, v0}, Lcom/fulishe/fs/newvideo/cache/m;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    invoke-direct {p0, v1}, Lcom/fulishe/fs/newvideo/cache/a;->a(Ljava/lang/Throwable;)V

    goto :goto_9

    :catch_16
    move-exception v0

    const-string v0, "HttpProxyCacheServer"

    const-string v1, "Releasing input stream\u2026 Socket is closed by client."

    invoke-static {v0, v1}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_9
.end method

.method private d(Ljava/net/Socket;)V
    .registers 5

    :try_start_0
    invoke-virtual {p1}, Ljava/net/Socket;->isOutputShutdown()Z

    move-result v0

    if-nez v0, :cond_9

    invoke-virtual {p1}, Ljava/net/Socket;->shutdownOutput()V
    :try_end_9
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_9} :catch_a

    :cond_9
    :goto_9
    return-void

    :catch_a
    move-exception v0

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "Failed to close socket on proxy side: {}. It seems client have already closed connection."

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v0}, Ljava/io/IOException;->getMessage()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "HttpProxyCacheServer"

    invoke-static {v1, v0}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_9
.end method

.method private e(Ljava/lang/String;)Ljava/lang/String;
    .registers 6

    sget-object v0, Ljava/util/Locale;->US:Ljava/util/Locale;

    const/4 v1, 0x3

    new-array v1, v1, [Ljava/lang/Object;

    const/4 v2, 0x0

    const-string v3, "127.0.0.1"

    aput-object v3, v1, v2

    iget v2, p0, Lcom/fulishe/fs/newvideo/cache/a;->e:I

    invoke-static {v2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v2

    const/4 v3, 0x1

    aput-object v2, v1, v3

    invoke-static {p1}, Lcom/fulishe/fs/newvideo/cache/q;->b(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    const/4 v3, 0x2

    aput-object v2, v1, v3

    const-string v2, "http://%s:%d/%s"

    invoke-static {v0, v2, v1}, Ljava/lang/String;->format(Ljava/util/Locale;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method private e(Ljava/net/Socket;)V
    .registers 5

    :try_start_0
    invoke-virtual {p1}, Ljava/net/Socket;->isClosed()Z

    move-result v0

    if-nez v0, :cond_9

    invoke-virtual {p1}, Ljava/net/Socket;->close()V
    :try_end_9
    .catchall {:try_start_0 .. :try_end_9} :catchall_a

    :cond_9
    :goto_9
    return-void

    :catchall_a
    move-exception v0

    new-instance v1, Lcom/fulishe/fs/newvideo/cache/m;

    const-string v2, "Error closing socket"

    invoke-direct {v1, v2, v0}, Lcom/fulishe/fs/newvideo/cache/m;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V

    invoke-direct {p0, v1}, Lcom/fulishe/fs/newvideo/cache/a;->a(Ljava/lang/Throwable;)V

    goto :goto_9
.end method

.method private f(Ljava/lang/String;)Ljava/io/File;
    .registers 5

    new-instance v0, Ljava/io/File;

    iget-object v1, p0, Lcom/fulishe/fs/newvideo/cache/a;->g:Lcom/fulishe/fs/newvideo/cache/e;

    iget-object v2, v1, Lcom/fulishe/fs/newvideo/cache/e;->a:Ljava/io/File;

    iget-object v1, v1, Lcom/fulishe/fs/newvideo/cache/e;->b:Lcom/fulishe/fs/newvideo/cache/a/c;

    invoke-interface {v1, p1}, Lcom/fulishe/fs/newvideo/cache/a/c;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-direct {v0, v2, v1}, Ljava/io/File;-><init>(Ljava/io/File;Ljava/lang/String;)V

    return-object v0
.end method

.method private g(Ljava/lang/String;)Lcom/fulishe/fs/newvideo/cache/f;
    .registers 5

    iget-object v1, p0, Lcom/fulishe/fs/newvideo/cache/a;->a:Ljava/lang/Object;

    monitor-enter v1

    :try_start_3
    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->c:Ljava/util/Map;

    invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/fulishe/fs/newvideo/cache/f;

    if-nez v0, :cond_19

    new-instance v0, Lcom/fulishe/fs/newvideo/cache/f;

    iget-object v2, p0, Lcom/fulishe/fs/newvideo/cache/a;->g:Lcom/fulishe/fs/newvideo/cache/e;

    invoke-direct {v0, p1, v2}, Lcom/fulishe/fs/newvideo/cache/f;-><init>(Ljava/lang/String;Lcom/fulishe/fs/newvideo/cache/e;)V

    iget-object v2, p0, Lcom/fulishe/fs/newvideo/cache/a;->c:Ljava/util/Map;

    invoke-interface {v2, p1, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    :cond_19
    monitor-exit v1

    return-object v0

    :catchall_1b
    move-exception v0

    monitor-exit v1
    :try_end_1d
    .catchall {:try_start_3 .. :try_end_1d} :catchall_1b

    throw v0
.end method


# virtual methods
.method public a(Lcom/fulishe/fs/c/a/a;)Ljava/lang/String;
    .registers 4

    if-nez p1, :cond_4

    const/4 v0, 0x0

    :goto_3
    return-object v0

    :cond_4
    iget-object v0, p1, Lcom/fulishe/fs/c/a/a;->a:Ljava/lang/String;

    const/4 v1, 0x1

    invoke-virtual {p0, v0, v1}, Lcom/fulishe/fs/newvideo/cache/a;->a(Ljava/lang/String;Z)Ljava/lang/String;

    move-result-object v0

    goto :goto_3
.end method

.method public a(Ljava/lang/String;)Ljava/lang/String;
    .registers 3

    const/4 v0, 0x1

    invoke-virtual {p0, p1, v0}, Lcom/fulishe/fs/newvideo/cache/a;->a(Ljava/lang/String;Z)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public a(Ljava/lang/String;Z)Ljava/lang/String;
    .registers 4

    if-eqz p2, :cond_8

    invoke-virtual {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->b(Ljava/lang/String;)Z

    move-result v0

    if-nez v0, :cond_13

    :cond_8
    invoke-direct {p0}, Lcom/fulishe/fs/newvideo/cache/a;->a()Z

    move-result v0

    if-eqz v0, :cond_12

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->e(Ljava/lang/String;)Ljava/lang/String;

    move-result-object p1

    :cond_12
    :goto_12
    return-object p1

    :cond_13
    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->f(Ljava/lang/String;)Ljava/io/File;

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/fulishe/fs/newvideo/cache/a;->a(Ljava/io/File;)V

    invoke-static {v0}, Landroid/net/Uri;->fromFile(Ljava/io/File;)Landroid/net/Uri;

    move-result-object v0

    invoke-virtual {v0}, Landroid/net/Uri;->toString()Ljava/lang/String;

    move-result-object p1

    goto :goto_12
.end method

.method public a(Ljava/lang/String;I)V
    .registers 5

    iput p2, p0, Lcom/fulishe/fs/newvideo/cache/a;->i:I

    invoke-direct {p0, p1, p2}, Lcom/fulishe/fs/newvideo/cache/a;->b(Ljava/lang/String;I)Ljava/lang/String;

    move-result-object v0

    if-eqz v0, :cond_9

    move-object p1, v0

    :cond_9
    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->g(Ljava/lang/String;)Lcom/fulishe/fs/newvideo/cache/f;

    move-result-object v0

    invoke-virtual {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->a(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1, p2}, Lcom/fulishe/fs/newvideo/cache/f;->a(Ljava/lang/String;I)V

    return-void
.end method

.method public a(Ljava/lang/String;Lcom/fulishe/fs/newvideo/cache/p$a;)V
    .registers 6

    :try_start_0
    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->g(Ljava/lang/String;)Lcom/fulishe/fs/newvideo/cache/f;

    move-result-object v0

    invoke-virtual {v0, p2}, Lcom/fulishe/fs/newvideo/cache/f;->a(Lcom/fulishe/fs/newvideo/cache/p$a;)V
    :try_end_7
    .catch Lcom/fulishe/fs/newvideo/cache/m; {:try_start_0 .. :try_end_7} :catch_8

    :goto_7
    return-void

    :catch_8
    move-exception v0

    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "registerPreLoadListener throws ProxyCacheException "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v0}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    const-string v1, "HttpProxyCacheServer"

    invoke-static {v1, v0}, Lcom/fulishe/shadow/base/p;->a(Ljava/lang/String;Ljava/lang/String;)V

    goto :goto_7
.end method

.method public b(Ljava/lang/String;)Z
    .registers 3

    const-string v0, "Url can\'t be null!"

    invoke-static {p1, v0}, Lcom/fulishe/fs/newvideo/cache/o;->a(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->f(Ljava/lang/String;)Ljava/io/File;

    move-result-object v0

    invoke-virtual {v0}, Ljava/io/File;->exists()Z

    move-result v0

    return v0
.end method

.method public c(Ljava/lang/String;)Ljava/io/File;
    .registers 3

    invoke-direct {p0, p1}, Lcom/fulishe/fs/newvideo/cache/a;->f(Ljava/lang/String;)Ljava/io/File;

    move-result-object v0

    return-object v0
.end method

.method public d(Ljava/lang/String;)V
    .registers 4

    :try_start_0
    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->c:Ljava/util/Map;

    invoke-interface {v0, p1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/fulishe/fs/newvideo/cache/f;

    if-eqz v0, :cond_1b

    invoke-virtual {v0, p1}, Lcom/fulishe/fs/newvideo/cache/f;->a(Ljava/lang/String;)V

    invoke-virtual {v0}, Lcom/fulishe/fs/newvideo/cache/f;->b()V

    iget-object v0, p0, Lcom/fulishe/fs/newvideo/cache/a;->c:Ljava/util/Map;

    iget v1, p0, Lcom/fulishe/fs/newvideo/cache/a;->i:I

    invoke-direct {p0, p1, v1}, Lcom/fulishe/fs/newvideo/cache/a;->b(Ljava/lang/String;I)Ljava/lang/String;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/Map;->remove(Ljava/lang/Object;)Ljava/lang/Object;
    :try_end_1b
    .catchall {:try_start_0 .. :try_end_1b} :catchall_1c

    :cond_1b
    :goto_1b
    return-void

    :catchall_1c
    move-exception v0

    goto :goto_1b
.end method