a.smali
.class public Lokio/a;
.super Lokio/r;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lokio/a$a;
}
.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 private static head:Lokio/a;
# instance fields
.field private inQueue:Z
.field private next:Lokio/a;
.field private timeoutAt:J
# direct methods
.method static constructor <clinit>()V
.registers 4
sget-object v0, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;
const-wide/16 v2, 0x3c
invoke-virtual {v0, v2, v3}, Ljava/util/concurrent/TimeUnit;->toMillis(J)J
move-result-wide v0
sput-wide v0, Lokio/a;->IDLE_TIMEOUT_MILLIS:J
sget-object v0, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
sget-wide v2, Lokio/a;->IDLE_TIMEOUT_MILLIS:J
invoke-virtual {v0, v2, v3}, 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/r;-><init>()V
return-void
.end method
.method static synthetic access$000()Lokio/a;
.registers 1
sget-object v0, Lokio/a;->head:Lokio/a;
return-object v0
.end method
.method static synthetic access$002(Lokio/a;)Lokio/a;
.registers 1
sput-object p0, Lokio/a;->head:Lokio/a;
return-object p0
.end method
.method static awaitTimeout()Lokio/a;
.registers 8
const-wide/32 v6, 0xf4240
const/4 v0, 0x0
sget-object v1, Lokio/a;->head:Lokio/a;
iget-object v1, v1, Lokio/a;->next:Lokio/a;
if-nez v1, :cond_2a
invoke-static {}, Ljava/lang/System;->nanoTime()J
move-result-wide v2
const-class v1, Lokio/a;
sget-wide v4, Lokio/a;->IDLE_TIMEOUT_MILLIS:J
invoke-virtual {v1, v4, v5}, Ljava/lang/Object;->wait(J)V
sget-object v1, Lokio/a;->head:Lokio/a;
iget-object v1, v1, Lokio/a;->next:Lokio/a;
if-nez v1, :cond_29
invoke-static {}, Ljava/lang/System;->nanoTime()J
move-result-wide v4
sub-long v2, v4, v2
sget-wide v4, Lokio/a;->IDLE_TIMEOUT_NANOS:J
cmp-long v1, v2, v4
if-ltz v1, :cond_29
sget-object v0, Lokio/a;->head:Lokio/a;
:cond_29
:goto_29
return-object v0
:cond_2a
invoke-static {}, Ljava/lang/System;->nanoTime()J
move-result-wide v2
invoke-direct {v1, v2, v3}, Lokio/a;->remainingNanos(J)J
move-result-wide v2
const-wide/16 v4, 0x0
cmp-long v4, v2, v4
if-lez v4, :cond_43
div-long v4, v2, v6
mul-long/2addr v6, v4
sub-long/2addr v2, v6
const-class v1, Lokio/a;
long-to-int v2, v2
invoke-virtual {v1, v4, v5, v2}, Ljava/lang/Object;->wait(JI)V
goto :goto_29
:cond_43
sget-object v2, Lokio/a;->head:Lokio/a;
iget-object v3, v1, Lokio/a;->next:Lokio/a;
iput-object v3, v2, Lokio/a;->next:Lokio/a;
iput-object v0, v1, Lokio/a;->next:Lokio/a;
move-object v0, v1
goto :goto_29
.end method
.method private static declared-synchronized cancelScheduledTimeout(Lokio/a;)Z
.registers 4
const-class v1, Lokio/a;
monitor-enter v1
:try_start_3
sget-object v0, Lokio/a;->head:Lokio/a;
:goto_5
if-eqz v0, :cond_18
iget-object v2, v0, Lokio/a;->next:Lokio/a;
if-ne v2, p0, :cond_15
iget-object v2, p0, Lokio/a;->next:Lokio/a;
iput-object v2, v0, Lokio/a;->next:Lokio/a;
const/4 v0, 0x0
iput-object v0, p0, Lokio/a;->next:Lokio/a;
:try_end_12
.catchall {:try_start_3 .. :try_end_12} :catchall_1a
const/4 v0, 0x0
:goto_13
monitor-exit v1
return v0
:cond_15
:try_start_15
iget-object v0, v0, Lokio/a;->next:Lokio/a;
:try_end_17
.catchall {:try_start_15 .. :try_end_17} :catchall_1a
goto :goto_5
:cond_18
const/4 v0, 0x1
goto :goto_13
:catchall_1a
move-exception v0
monitor-exit v1
throw v0
.end method
.method private remainingNanos(J)J
.registers 6
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 13
const-wide/16 v4, 0x0
const-class v1, Lokio/a;
monitor-enter v1
:try_start_5
sget-object v0, Lokio/a;->head:Lokio/a;
if-nez v0, :cond_18
new-instance v0, Lokio/a;
invoke-direct {v0}, Lokio/a;-><init>()V
sput-object v0, Lokio/a;->head:Lokio/a;
new-instance v0, Lokio/a$a;
invoke-direct {v0}, Lokio/a$a;-><init>()V
invoke-virtual {v0}, Lokio/a$a;->start()V
:cond_18
invoke-static {}, Ljava/lang/System;->nanoTime()J
move-result-wide v2
cmp-long v0, p1, v4
if-eqz v0, :cond_53
if-eqz p3, :cond_53
invoke-virtual {p0}, Lokio/a;->deadlineNanoTime()J
move-result-wide v4
sub-long/2addr v4, v2
invoke-static {p1, p2, v4, v5}, Ljava/lang/Math;->min(JJ)J
move-result-wide v4
add-long/2addr v4, v2
iput-wide v4, p0, Lokio/a;->timeoutAt:J
:goto_2e
invoke-direct {p0, v2, v3}, Lokio/a;->remainingNanos(J)J
move-result-wide v4
sget-object v0, Lokio/a;->head:Lokio/a;
:goto_34
iget-object v6, v0, Lokio/a;->next:Lokio/a;
if-eqz v6, :cond_42
iget-object v6, v0, Lokio/a;->next:Lokio/a;
invoke-direct {v6, v2, v3}, Lokio/a;->remainingNanos(J)J
move-result-wide v6
cmp-long v6, v4, v6
if-gez v6, :cond_6e
:cond_42
iget-object v2, v0, Lokio/a;->next:Lokio/a;
iput-object v2, p0, Lokio/a;->next:Lokio/a;
iput-object p0, v0, Lokio/a;->next:Lokio/a;
sget-object v2, Lokio/a;->head:Lokio/a;
if-ne v0, v2, :cond_51
const-class v0, Lokio/a;
invoke-virtual {v0}, Ljava/lang/Object;->notify()V
:try_end_51
.catchall {:try_start_5 .. :try_end_51} :catchall_5c
:cond_51
monitor-exit v1
return-void
:cond_53
cmp-long v0, p1, v4
if-eqz v0, :cond_5f
add-long v4, v2, p1
:try_start_59
iput-wide v4, p0, Lokio/a;->timeoutAt:J
:try_end_5b
.catchall {:try_start_59 .. :try_end_5b} :catchall_5c
goto :goto_2e
:catchall_5c
move-exception v0
monitor-exit v1
throw v0
:cond_5f
if-eqz p3, :cond_68
:try_start_61
invoke-virtual {p0}, Lokio/a;->deadlineNanoTime()J
move-result-wide v4
iput-wide v4, p0, Lokio/a;->timeoutAt:J
goto :goto_2e
:cond_68
new-instance v0, Ljava/lang/AssertionError;
invoke-direct {v0}, Ljava/lang/AssertionError;-><init>()V
throw v0
:cond_6e
iget-object v0, v0, Lokio/a;->next:Lokio/a;
:try_end_70
.catchall {:try_start_61 .. :try_end_70} :catchall_5c
goto :goto_34
.end method
# virtual methods
.method public final enter()V
.registers 7
iget-boolean v0, p0, Lokio/a;->inQueue:Z
if-eqz v0, :cond_d
new-instance v0, Ljava/lang/IllegalStateException;
const-string/jumbo v1, "Unbalanced enter/exit"
invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
:cond_d
invoke-virtual {p0}, Lokio/a;->timeoutNanos()J
move-result-wide v0
invoke-virtual {p0}, Lokio/a;->hasDeadline()Z
move-result v2
const-wide/16 v4, 0x0
cmp-long v3, v0, v4
if-nez v3, :cond_1e
if-nez v2, :cond_1e
:goto_1d
return-void
:cond_1e
const/4 v3, 0x1
iput-boolean v3, p0, Lokio/a;->inQueue:Z
invoke-static {p0, v0, v1, v2}, Lokio/a;->scheduleTimeout(Lokio/a;JZ)V
goto :goto_1d
.end method
.method final exit(Ljava/io/IOException;)Ljava/io/IOException;
.registers 3
invoke-virtual {p0}, Lokio/a;->exit()Z
move-result v0
if-nez v0, :cond_7
:goto_6
return-object p1
:cond_7
invoke-virtual {p0, p1}, Lokio/a;->newTimeoutException(Ljava/io/IOException;)Ljava/io/IOException;
move-result-object p1
goto :goto_6
.end method
.method final exit(Z)V
.registers 3
invoke-virtual {p0}, Lokio/a;->exit()Z
move-result v0
if-eqz v0, :cond_e
if-eqz p1, :cond_e
const/4 v0, 0x0
invoke-virtual {p0, v0}, Lokio/a;->newTimeoutException(Ljava/io/IOException;)Ljava/io/IOException;
move-result-object v0
throw v0
:cond_e
return-void
.end method
.method public final exit()Z
.registers 3
const/4 v0, 0x0
iget-boolean v1, p0, Lokio/a;->inQueue:Z
if-nez v1, :cond_6
:goto_5
return v0
:cond_6
iput-boolean v0, p0, Lokio/a;->inQueue:Z
invoke-static {p0}, Lokio/a;->cancelScheduledTimeout(Lokio/a;)Z
move-result v0
goto :goto_5
.end method
.method protected newTimeoutException(Ljava/io/IOException;)Ljava/io/IOException;
.registers 4
new-instance v0, Ljava/io/InterruptedIOException;
const-string/jumbo v1, "timeout"
invoke-direct {v0, v1}, Ljava/io/InterruptedIOException;-><init>(Ljava/lang/String;)V
if-eqz p1, :cond_d
invoke-virtual {v0, p1}, Ljava/io/InterruptedIOException;->initCause(Ljava/lang/Throwable;)Ljava/lang/Throwable;
:cond_d
return-object v0
.end method
.method public final sink(Lokio/p;)Lokio/p;
.registers 3
new-instance v0, Lokio/a$1;
invoke-direct {v0, p0, p1}, Lokio/a$1;-><init>(Lokio/a;Lokio/p;)V
return-object v0
.end method
.method public final source(Lokio/q;)Lokio/q;
.registers 3
new-instance v0, Lokio/a$2;
invoke-direct {v0, p0, p1}, Lokio/a$2;-><init>(Lokio/a;Lokio/q;)V
return-object v0
.end method
.method protected timedOut()V
.registers 1
return-void
.end method