p$a.smali

.class final Lokhttp3/internal/http2/p$a;
.super Ljava/lang/Object;
.source "Http2Stream.java"

# interfaces
.implements Lokio/Sink;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lokhttp3/internal/http2/p;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x10
    name = "a"
.end annotation


# instance fields
.field private final a:Lokio/Buffer;

.field b:Z

.field c:Z

.field final synthetic d:Lokhttp3/internal/http2/p;


# direct methods
.method constructor <init>(Lokhttp3/internal/http2/p;)V
    .registers 2

    .line 1
    iput-object p1, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

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

    .line 2
    new-instance p1, Lokio/Buffer;

    invoke-direct {p1}, Lokio/Buffer;-><init>()V

    iput-object p1, p0, Lokhttp3/internal/http2/p$a;->a:Lokio/Buffer;

    return-void
.end method

.method private a(Z)V
    .registers 13
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    monitor-enter v0

    .line 2
    :try_start_3
    iget-object v1, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object v1, v1, Lokhttp3/internal/http2/p;->k:Lokhttp3/internal/http2/p$c;

    invoke-virtual {v1}, Lokio/AsyncTimeout;->enter()V
    :try_end_a
    .catchall {:try_start_3 .. :try_end_a} :catchall_89

    .line 3
    :goto_a
    :try_start_a
    iget-object v1, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-wide v1, v1, Lokhttp3/internal/http2/p;->b:J

    const-wide/16 v3, 0x0

    cmp-long v5, v1, v3

    if-gtz v5, :cond_28

    iget-boolean v1, p0, Lokhttp3/internal/http2/p$a;->c:Z

    if-nez v1, :cond_28

    iget-boolean v1, p0, Lokhttp3/internal/http2/p$a;->b:Z

    if-nez v1, :cond_28

    iget-object v1, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object v1, v1, Lokhttp3/internal/http2/p;->l:Lokhttp3/internal/http2/ErrorCode;

    if-nez v1, :cond_28

    .line 4
    iget-object v1, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    invoke-virtual {v1}, Lokhttp3/internal/http2/p;->k()V
    :try_end_27
    .catchall {:try_start_a .. :try_end_27} :catchall_80

    goto :goto_a

    .line 5
    :cond_28
    :try_start_28
    iget-object v1, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object v1, v1, Lokhttp3/internal/http2/p;->k:Lokhttp3/internal/http2/p$c;

    invoke-virtual {v1}, Lokhttp3/internal/http2/p$c;->exitAndThrowIfTimedOut()V

    .line 6
    iget-object v1, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    invoke-virtual {v1}, Lokhttp3/internal/http2/p;->b()V

    .line 7
    iget-object v1, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-wide v1, v1, Lokhttp3/internal/http2/p;->b:J

    iget-object v3, p0, Lokhttp3/internal/http2/p$a;->a:Lokio/Buffer;

    invoke-virtual {v3}, Lokio/Buffer;->size()J

    move-result-wide v3

    invoke-static {v1, v2, v3, v4}, Ljava/lang/Math;->min(JJ)J

    move-result-wide v9

    .line 8
    iget-object v1, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-wide v2, v1, Lokhttp3/internal/http2/p;->b:J

    sub-long/2addr v2, v9

    iput-wide v2, v1, Lokhttp3/internal/http2/p;->b:J

    .line 9
    monitor-exit v0
    :try_end_4a
    .catchall {:try_start_28 .. :try_end_4a} :catchall_89

    .line 10
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object v0, v0, Lokhttp3/internal/http2/p;->k:Lokhttp3/internal/http2/p$c;

    invoke-virtual {v0}, Lokio/AsyncTimeout;->enter()V

    .line 11
    :try_start_51
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object v5, v0, Lokhttp3/internal/http2/p;->d:Lokhttp3/internal/http2/k;

    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget v6, v0, Lokhttp3/internal/http2/p;->c:I

    if-eqz p1, :cond_68

    iget-object p1, p0, Lokhttp3/internal/http2/p$a;->a:Lokio/Buffer;

    invoke-virtual {p1}, Lokio/Buffer;->size()J

    move-result-wide v0

    cmp-long p1, v9, v0

    if-nez p1, :cond_68

    const/4 p1, 0x1

    const/4 v7, 0x1

    goto :goto_6a

    :cond_68
    const/4 p1, 0x0

    const/4 v7, 0x0

    :goto_6a
    iget-object v8, p0, Lokhttp3/internal/http2/p$a;->a:Lokio/Buffer;

    invoke-virtual/range {v5 .. v10}, Lokhttp3/internal/http2/k;->a(IZLokio/Buffer;J)V
    :try_end_6f
    .catchall {:try_start_51 .. :try_end_6f} :catchall_77

    .line 12
    iget-object p1, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object p1, p1, Lokhttp3/internal/http2/p;->k:Lokhttp3/internal/http2/p$c;

    invoke-virtual {p1}, Lokhttp3/internal/http2/p$c;->exitAndThrowIfTimedOut()V

    return-void

    :catchall_77
    move-exception p1

    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object v0, v0, Lokhttp3/internal/http2/p;->k:Lokhttp3/internal/http2/p$c;

    invoke-virtual {v0}, Lokhttp3/internal/http2/p$c;->exitAndThrowIfTimedOut()V

    throw p1

    :catchall_80
    move-exception p1

    .line 13
    :try_start_81
    iget-object v1, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object v1, v1, Lokhttp3/internal/http2/p;->k:Lokhttp3/internal/http2/p$c;

    invoke-virtual {v1}, Lokhttp3/internal/http2/p$c;->exitAndThrowIfTimedOut()V

    throw p1

    :catchall_89
    move-exception p1

    .line 14
    monitor-exit v0
    :try_end_8b
    .catchall {:try_start_81 .. :try_end_8b} :catchall_89

    goto :goto_8d

    :goto_8c
    throw p1

    :goto_8d
    goto :goto_8c
.end method


# virtual methods
.method public close()V
    .registers 9
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    monitor-enter v0

    .line 2
    :try_start_3
    iget-boolean v1, p0, Lokhttp3/internal/http2/p$a;->b:Z

    if-eqz v1, :cond_9

    monitor-exit v0

    return-void

    .line 3
    :cond_9
    monitor-exit v0
    :try_end_a
    .catchall {:try_start_3 .. :try_end_a} :catchall_50

    .line 4
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object v0, v0, Lokhttp3/internal/http2/p;->i:Lokhttp3/internal/http2/p$a;

    iget-boolean v0, v0, Lokhttp3/internal/http2/p$a;->c:Z

    const/4 v1, 0x1

    if-nez v0, :cond_3a

    .line 5
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->a:Lokio/Buffer;

    invoke-virtual {v0}, Lokio/Buffer;->size()J

    move-result-wide v2

    const-wide/16 v4, 0x0

    cmp-long v0, v2, v4

    if-lez v0, :cond_2d

    .line 6
    :goto_1f
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->a:Lokio/Buffer;

    invoke-virtual {v0}, Lokio/Buffer;->size()J

    move-result-wide v2

    cmp-long v0, v2, v4

    if-lez v0, :cond_3a

    .line 7
    invoke-direct {p0, v1}, Lokhttp3/internal/http2/p$a;->a(Z)V

    goto :goto_1f

    .line 8
    :cond_2d
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object v2, v0, Lokhttp3/internal/http2/p;->d:Lokhttp3/internal/http2/k;

    iget v3, v0, Lokhttp3/internal/http2/p;->c:I

    const/4 v4, 0x1

    const/4 v5, 0x0

    const-wide/16 v6, 0x0

    invoke-virtual/range {v2 .. v7}, Lokhttp3/internal/http2/k;->a(IZLokio/Buffer;J)V

    .line 9
    :cond_3a
    iget-object v2, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    monitor-enter v2

    .line 10
    :try_start_3d
    iput-boolean v1, p0, Lokhttp3/internal/http2/p$a;->b:Z

    .line 11
    monitor-exit v2
    :try_end_40
    .catchall {:try_start_3d .. :try_end_40} :catchall_4d

    .line 12
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object v0, v0, Lokhttp3/internal/http2/p;->d:Lokhttp3/internal/http2/k;

    invoke-virtual {v0}, Lokhttp3/internal/http2/k;->flush()V

    .line 13
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    invoke-virtual {v0}, Lokhttp3/internal/http2/p;->a()V

    return-void

    :catchall_4d
    move-exception v0

    .line 14
    :try_start_4e
    monitor-exit v2
    :try_end_4f
    .catchall {:try_start_4e .. :try_end_4f} :catchall_4d

    throw v0

    :catchall_50
    move-exception v1

    .line 15
    :try_start_51
    monitor-exit v0
    :try_end_52
    .catchall {:try_start_51 .. :try_end_52} :catchall_50

    goto :goto_54

    :goto_53
    throw v1

    :goto_54
    goto :goto_53
.end method

.method public flush()V
    .registers 6
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    monitor-enter v0

    .line 2
    :try_start_3
    iget-object v1, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    invoke-virtual {v1}, Lokhttp3/internal/http2/p;->b()V

    .line 3
    monitor-exit v0
    :try_end_9
    .catchall {:try_start_3 .. :try_end_9} :catchall_22

    .line 4
    :goto_9
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->a:Lokio/Buffer;

    invoke-virtual {v0}, Lokio/Buffer;->size()J

    move-result-wide v0

    const-wide/16 v2, 0x0

    cmp-long v4, v0, v2

    if-lez v4, :cond_21

    const/4 v0, 0x0

    .line 5
    invoke-direct {p0, v0}, Lokhttp3/internal/http2/p$a;->a(Z)V

    .line 6
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object v0, v0, Lokhttp3/internal/http2/p;->d:Lokhttp3/internal/http2/k;

    invoke-virtual {v0}, Lokhttp3/internal/http2/k;->flush()V

    goto :goto_9

    :cond_21
    return-void

    :catchall_22
    move-exception v1

    .line 7
    :try_start_23
    monitor-exit v0
    :try_end_24
    .catchall {:try_start_23 .. :try_end_24} :catchall_22

    goto :goto_26

    :goto_25
    throw v1

    :goto_26
    goto :goto_25
.end method

.method public timeout()Lokio/Timeout;
    .registers 2

    .line 1
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->d:Lokhttp3/internal/http2/p;

    iget-object v0, v0, Lokhttp3/internal/http2/p;->k:Lokhttp3/internal/http2/p$c;

    return-object v0
.end method

.method public write(Lokio/Buffer;J)V
    .registers 6
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/io/IOException;
        }
    .end annotation

    .line 1
    iget-object v0, p0, Lokhttp3/internal/http2/p$a;->a:Lokio/Buffer;

    invoke-virtual {v0, p1, p2, p3}, Lokio/Buffer;->write(Lokio/Buffer;J)V

    .line 2
    :goto_5
    iget-object p1, p0, Lokhttp3/internal/http2/p$a;->a:Lokio/Buffer;

    invoke-virtual {p1}, Lokio/Buffer;->size()J

    move-result-wide p1

    const-wide/16 v0, 0x4000

    cmp-long p3, p1, v0

    if-ltz p3, :cond_16

    const/4 p1, 0x0

    .line 3
    invoke-direct {p0, p1}, Lokhttp3/internal/http2/p$a;->a(Z)V

    goto :goto_5

    :cond_16
    return-void
.end method