a.smali
.class public Lokio/a;
.super Lokio/x;
.source "SourceFile"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lokio/a$c;
}
.end annotation
# static fields
.field private static final IDLE_TIMEOUT_MILLIS:J
.field private static final IDLE_TIMEOUT_NANOS:J
.field private static final TIMEOUT_WRITE_SIZE:I = 0x10000
.field public static head:Lokio/a;
# instance fields
.field private inQueue:Z
.field private next:Lokio/a;
.field private timeoutAt:J
# direct methods
.method public static constructor <clinit>()V
.registers 3
.line 1
sget-object v0, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
const-wide/16 v1, 0x3c
invoke-virtual {v0, v1, v2}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J
move-result-wide v0
sput-wide v0, Lokio/a;->IDLE_TIMEOUT_MILLIS:J
.line 2
sget-object v2, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
invoke-virtual {v2, v0, v1}, Ljava/util/concurrent/TimeUnit;->toNanos(J)J
move-result-wide v0
sput-wide v0, Lokio/a;->IDLE_TIMEOUT_NANOS:J
return-void
.end method
.method public constructor <init>()V
.registers 1
invoke-direct {p0}, Lokio/x;-><init>()V
return-void
.end method
.method public static INVOKEVIRTUAL_okio_AsyncTimeout_com_shopee_app_asm_fix_androidx_ThreadFixer_start(Lokio/a$c;)V
.registers 3
.line 1
:try_start_0
invoke-static {}, Lcom/shopee/app/asm/fix/androidx/b;->b()Z
move-result v0
if-eqz v0, :cond_12
.line 2
invoke-static {p0}, Lcom/shopee/app/asm/fix/androidx/b;->a(Ljava/lang/Thread;)V
:try_end_9
.catchall {:try_start_0 .. :try_end_9} :catchall_a
goto :goto_12
:catchall_a
move-exception v0
.line 3
invoke-static {}, Lcom/shopee/app/apm/c;->d()Lcom/shopee/app/apm/nonfatal/a;
move-result-object v1
invoke-virtual {v1, v0}, Lcom/shopee/app/apm/nonfatal/a;->c(Ljava/lang/Throwable;)V
.line 4
:cond_12
:goto_12
invoke-virtual {p0}, Ljava/lang/Thread;->start()V
return-void
.end method
.method public static awaitTimeout()Lokio/a;
.registers 9
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/InterruptedException;
}
.end annotation
.line 1
const-class v0, Lokio/a;
sget-object v1, Lokio/a;->head:Lokio/a;
iget-object v1, v1, Lokio/a;->next:Lokio/a;
const/4 v2, 0x0
if-nez v1, :cond_26
.line 2
invoke-static {}, Ljava/lang/System;->nanoTime()J
move-result-wide v3
.line 3
sget-wide v5, Lokio/a;->IDLE_TIMEOUT_MILLIS:J
invoke-virtual {v0, v5, v6}, Ljava/lang/Object;->wait(J)V
.line 4
sget-object v0, Lokio/a;->head:Lokio/a;
iget-object v0, v0, Lokio/a;->next:Lokio/a;
if-nez v0, :cond_25
invoke-static {}, Ljava/lang/System;->nanoTime()J
move-result-wide v0
sub-long/2addr v0, v3
sget-wide v3, Lokio/a;->IDLE_TIMEOUT_NANOS:J
cmp-long v5, v0, v3
if-ltz v5, :cond_25
.line 5
sget-object v2, Lokio/a;->head:Lokio/a;
:cond_25
return-object v2
.line 6
:cond_26
invoke-static {}, Ljava/lang/System;->nanoTime()J
move-result-wide v3
invoke-direct {v1, v3, v4}, Lokio/a;->remainingNanos(J)J
move-result-wide v3
const-wide/16 v5, 0x0
cmp-long v7, v3, v5
if-lez v7, :cond_41
const-wide/32 v5, 0xf4240
.line 7
div-long v7, v3, v5
mul-long v5, v5, v7
sub-long/2addr v3, v5
long-to-int v1, v3
.line 8
invoke-virtual {v0, v7, v8, v1}, Ljava/lang/Object;->wait(JI)V
return-object v2
.line 9
:cond_41
sget-object v0, Lokio/a;->head:Lokio/a;
iget-object v3, v1, Lokio/a;->next:Lokio/a;
iput-object v3, v0, Lokio/a;->next:Lokio/a;
.line 10
iput-object v2, v1, Lokio/a;->next:Lokio/a;
return-object v1
.end method
.method private static declared-synchronized cancelScheduledTimeout(Lokio/a;)Z
.registers 4
const-class v0, Lokio/a;
monitor-enter v0
.line 1
:try_start_3
sget-object v1, Lokio/a;->head:Lokio/a;
:goto_5
if-eqz v1, :cond_17
.line 2
iget-object v2, v1, Lokio/a;->next:Lokio/a;
if-ne v2, p0, :cond_15
.line 3
iget-object v2, p0, Lokio/a;->next:Lokio/a;
iput-object v2, v1, Lokio/a;->next:Lokio/a;
const/4 v1, 0x0
.line 4
iput-object v1, p0, Lokio/a;->next:Lokio/a;
:try_end_12
.catchall {:try_start_3 .. :try_end_12} :catchall_1a
const/4 p0, 0x0
.line 5
monitor-exit v0
return p0
:cond_15
move-object v1, v2
goto :goto_5
:cond_17
const/4 p0, 0x1
.line 6
monitor-exit v0
return p0
:catchall_1a
move-exception p0
monitor-exit v0
throw p0
.end method
.method private remainingNanos(J)J
.registers 5
iget-wide v0, p0, Lokio/a;->timeoutAt:J
sub-long/2addr v0, p1
return-wide v0
.end method
.method private static declared-synchronized scheduleTimeout(Lokio/a;JZ)V
.registers 10
const-class v0, Lokio/a;
monitor-enter v0
.line 1
:try_start_3
sget-object v1, Lokio/a;->head:Lokio/a;
if-nez v1, :cond_16
.line 2
new-instance v1, Lokio/a;
invoke-direct {v1}, Lokio/a;-><init>()V
sput-object v1, Lokio/a;->head:Lokio/a;
.line 3
new-instance v1, Lokio/a$c;
invoke-direct {v1}, Lokio/a$c;-><init>()V
invoke-static {v1}, Lokio/a;->INVOKEVIRTUAL_okio_AsyncTimeout_com_shopee_app_asm_fix_androidx_ThreadFixer_start(Lokio/a$c;)V
.line 4
:cond_16
invoke-static {}, Ljava/lang/System;->nanoTime()J
move-result-wide v1
const-wide/16 v3, 0x0
cmp-long v5, p1, v3
if-eqz v5, :cond_2f
if-eqz p3, :cond_2f
.line 5
invoke-virtual {p0}, Lokio/x;->deadlineNanoTime()J
move-result-wide v3
sub-long/2addr v3, v1
invoke-static {p1, p2, v3, v4}, Ljava/lang/Math;->min(JJ)J
move-result-wide p1
add-long/2addr p1, v1
iput-wide p1, p0, Lokio/a;->timeoutAt:J
goto :goto_3d
:cond_2f
if-eqz v5, :cond_35
add-long/2addr p1, v1
.line 6
iput-wide p1, p0, Lokio/a;->timeoutAt:J
goto :goto_3d
:cond_35
if-eqz p3, :cond_62
.line 7
invoke-virtual {p0}, Lokio/x;->deadlineNanoTime()J
move-result-wide p1
iput-wide p1, p0, Lokio/a;->timeoutAt:J
.line 8
:goto_3d
invoke-direct {p0, v1, v2}, Lokio/a;->remainingNanos(J)J
move-result-wide p1
.line 9
sget-object p3, Lokio/a;->head:Lokio/a;
.line 10
:goto_43
iget-object v3, p3, Lokio/a;->next:Lokio/a;
if-eqz v3, :cond_53
invoke-direct {v3, v1, v2}, Lokio/a;->remainingNanos(J)J
move-result-wide v3
cmp-long v5, p1, v3
if-gez v5, :cond_50
goto :goto_53
.line 11
:cond_50
iget-object p3, p3, Lokio/a;->next:Lokio/a;
goto :goto_43
.line 12
:cond_53
:goto_53
iget-object p1, p3, Lokio/a;->next:Lokio/a;
iput-object p1, p0, Lokio/a;->next:Lokio/a;
.line 13
iput-object p0, p3, Lokio/a;->next:Lokio/a;
.line 14
sget-object p0, Lokio/a;->head:Lokio/a;
if-ne p3, p0, :cond_60
.line 15
invoke-virtual {v0}, Ljava/lang/Object;->notify()V
:try_end_60
.catchall {:try_start_3 .. :try_end_60} :catchall_68
.line 16
:cond_60
monitor-exit v0
return-void
.line 17
:cond_62
:try_start_62
new-instance p0, Ljava/lang/AssertionError;
invoke-direct {p0}, Ljava/lang/AssertionError;-><init>()V
throw p0
:try_end_68
.catchall {:try_start_62 .. :try_end_68} :catchall_68
:catchall_68
move-exception p0
monitor-exit v0
throw p0
.end method
# virtual methods
.method public final enter()V
.registers 7
.line 1
iget-boolean v0, p0, Lokio/a;->inQueue:Z
if-nez v0, :cond_1c
.line 2
invoke-virtual {p0}, Lokio/x;->timeoutNanos()J
move-result-wide v0
.line 3
invoke-virtual {p0}, Lokio/x;->hasDeadline()Z
move-result v2
const-wide/16 v3, 0x0
cmp-long v5, v0, v3
if-nez v5, :cond_15
if-nez v2, :cond_15
return-void
:cond_15
const/4 v3, 0x1
.line 4
iput-boolean v3, p0, Lokio/a;->inQueue:Z
.line 5
invoke-static {p0, v0, v1, v2}, Lokio/a;->scheduleTimeout(Lokio/a;JZ)V
return-void
.line 6
:cond_1c
new-instance v0, Ljava/lang/IllegalStateException;
const-string v1, "Unbalanced enter/exit"
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
.end method
.method public final exit(Ljava/io/IOException;)Ljava/io/IOException;
.registers 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 6
invoke-virtual {p0}, Lokio/a;->exit()Z
move-result v0
if-nez v0, :cond_7
return-object p1
.line 7
:cond_7
invoke-virtual {p0, p1}, Lokio/a;->newTimeoutException(Ljava/io/IOException;)Ljava/io/IOException;
move-result-object p1
return-object p1
.end method
.method public final exit(Z)V
.registers 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 4
invoke-virtual {p0}, Lokio/a;->exit()Z
move-result v0
if-eqz v0, :cond_f
if-nez p1, :cond_9
goto :goto_f
:cond_9
const/4 p1, 0x0
.line 5
invoke-virtual {p0, p1}, Lokio/a;->newTimeoutException(Ljava/io/IOException;)Ljava/io/IOException;
move-result-object p1
throw p1
:cond_f
:goto_f
return-void
.end method
.method public final exit()Z
.registers 3
.line 1
iget-boolean v0, p0, Lokio/a;->inQueue:Z
const/4 v1, 0x0
if-nez v0, :cond_6
return v1
.line 2
:cond_6
iput-boolean v1, p0, Lokio/a;->inQueue:Z
.line 3
invoke-static {p0}, Lokio/a;->cancelScheduledTimeout(Lokio/a;)Z
move-result v0
return v0
.end method
.method public newTimeoutException(Ljava/io/IOException;)Ljava/io/IOException;
.registers 4
.line 1
new-instance v0, Ljava/io/InterruptedIOException;
const-string v1, "timeout"
invoke-direct {v0, v1}, Ljava/io/InterruptedIOException;-><init>(Ljava/lang/String;)V
if-eqz p1, :cond_c
.line 2
invoke-virtual {v0, p1}, Ljava/lang/Throwable;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;
:cond_c
return-object v0
.end method
.method public final sink(Lokio/v;)Lokio/v;
.registers 3
new-instance v0, Lokio/a$a;
invoke-direct {v0, p0, p1}, Lokio/a$a;-><init>(Lokio/a;Lokio/v;)V
return-object v0
.end method
.method public final source(Lokio/w;)Lokio/w;
.registers 3
new-instance v0, Lokio/a$b;
invoke-direct {v0, p0, p1}, Lokio/a$b;-><init>(Lokio/a;Lokio/w;)V
return-object v0
.end method
.method public timedOut()V
.registers 1
return-void
.end method