r.smali

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

# interfaces
.implements Lokio/s;


# static fields
.field private static synthetic $assertionsDisabled:Z


# instance fields
.field private synthetic bYp:Lokhttp3/internal/http2/p;

.field byI:Z

.field private final byK:Lokio/d;

.field private final byL:Lokio/d;

.field private final byM:J

.field closed:Z


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 309
    const-class v0, Lokhttp3/internal/http2/p;

    invoke-virtual {v0}, Ljava/lang/Class;->desiredAssertionStatus()Z

    move-result v0

    if-nez v0, :cond_c

    const/4 v0, 0x1

    :goto_9
    sput-boolean v0, Lokhttp3/internal/http2/r;->$assertionsDisabled:Z

    return-void

    :cond_c
    const/4 v0, 0x0

    goto :goto_9
.end method

.method constructor <init>(Lokhttp3/internal/http2/p;J)V
    .registers 6

    .prologue
    .line 328
    iput-object p1, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

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

    .line 311
    new-instance v0, Lokio/d;

    invoke-direct {v0}, Lokio/d;-><init>()V

    iput-object v0, p0, Lokhttp3/internal/http2/r;->byK:Lokio/d;

    .line 314
    new-instance v0, Lokio/d;

    invoke-direct {v0}, Lokio/d;-><init>()V

    iput-object v0, p0, Lokhttp3/internal/http2/r;->byL:Lokio/d;

    .line 329
    iput-wide p2, p0, Lokhttp3/internal/http2/r;->byM:J

    .line 330
    return-void
.end method

.method private Hw()V
    .registers 5

    .prologue
    .line 368
    iget-object v0, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v0, v0, Lokhttp3/internal/http2/p;->bYn:Lokhttp3/internal/http2/s;

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

    .line 370
    :goto_7
    :try_start_7
    iget-object v0, p0, Lokhttp3/internal/http2/r;->byL:Lokio/d;

    .line 4067
    iget-wide v0, v0, Lokio/d;->size:J

    .line 370
    const-wide/16 v2, 0x0

    cmp-long v0, v0, v2

    if-nez v0, :cond_2e

    iget-boolean v0, p0, Lokhttp3/internal/http2/r;->byI:Z

    if-nez v0, :cond_2e

    iget-boolean v0, p0, Lokhttp3/internal/http2/r;->closed:Z

    if-nez v0, :cond_2e

    iget-object v0, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v0, v0, Lokhttp3/internal/http2/p;->errorCode:Lokhttp3/internal/http2/ErrorCode;

    if-nez v0, :cond_2e

    .line 371
    iget-object v0, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    invoke-virtual {v0}, Lokhttp3/internal/http2/p;->Hv()V
    :try_end_24
    .catchall {:try_start_7 .. :try_end_24} :catchall_25

    goto :goto_7

    .line 374
    :catchall_25
    move-exception v0

    iget-object v1, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v1, v1, Lokhttp3/internal/http2/p;->bYn:Lokhttp3/internal/http2/s;

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

    throw v0

    :cond_2e
    iget-object v0, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v0, v0, Lokhttp3/internal/http2/p;->bYn:Lokhttp3/internal/http2/s;

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

    .line 375
    return-void
.end method


# virtual methods
.method final a(Lokio/f;J)V
    .registers 16

    .prologue
    const-wide/16 v10, 0x0

    const/4 v1, 0x1

    const/4 v2, 0x0

    .line 379
    sget-boolean v0, Lokhttp3/internal/http2/r;->$assertionsDisabled:Z

    if-nez v0, :cond_32

    iget-object v0, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    invoke-static {v0}, Ljava/lang/Thread;->holdsLock(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_32

    new-instance v0, Ljava/lang/AssertionError;

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

    throw v0

    .line 405
    :cond_16
    sub-long/2addr p2, v4

    .line 408
    iget-object v3, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    monitor-enter v3

    .line 409
    :try_start_1a
    iget-object v0, p0, Lokhttp3/internal/http2/r;->byL:Lokio/d;

    .line 6067
    iget-wide v4, v0, Lokio/d;->size:J

    .line 409
    cmp-long v0, v4, v10

    if-nez v0, :cond_72

    move v0, v1

    .line 410
    :goto_23
    iget-object v4, p0, Lokhttp3/internal/http2/r;->byL:Lokio/d;

    iget-object v5, p0, Lokhttp3/internal/http2/r;->byK:Lokio/d;

    invoke-virtual {v4, v5}, Lokio/d;->a(Lokio/s;)J

    .line 411
    if-eqz v0, :cond_31

    .line 412
    iget-object v0, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 414
    :cond_31
    monitor-exit v3
    :try_end_32
    .catchall {:try_start_1a .. :try_end_32} :catchall_74

    .line 381
    :cond_32
    cmp-long v0, p2, v10

    if-lez v0, :cond_54

    .line 384
    iget-object v3, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    monitor-enter v3

    .line 385
    :try_start_39
    iget-boolean v4, p0, Lokhttp3/internal/http2/r;->byI:Z

    .line 386
    iget-object v0, p0, Lokhttp3/internal/http2/r;->byL:Lokio/d;

    .line 5067
    iget-wide v6, v0, Lokio/d;->size:J

    .line 386
    add-long/2addr v6, p2

    iget-wide v8, p0, Lokhttp3/internal/http2/r;->byM:J

    cmp-long v0, v6, v8

    if-lez v0, :cond_55

    move v0, v1

    .line 387
    :goto_47
    monitor-exit v3
    :try_end_48
    .catchall {:try_start_39 .. :try_end_48} :catchall_57

    .line 390
    if-eqz v0, :cond_5a

    .line 391
    invoke-interface {p1, p2, p3}, Lokio/f;->Y(J)V

    .line 392
    iget-object v0, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    sget-object v1, Lokhttp3/internal/http2/ErrorCode;->FLOW_CONTROL_ERROR:Lokhttp3/internal/http2/ErrorCode;

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

    .line 416
    :cond_54
    :goto_54
    return-void

    :cond_55
    move v0, v2

    .line 386
    goto :goto_47

    .line 387
    :catchall_57
    move-exception v0

    :try_start_58
    monitor-exit v3
    :try_end_59
    .catchall {:try_start_58 .. :try_end_59} :catchall_57

    throw v0

    .line 397
    :cond_5a
    if-eqz v4, :cond_60

    .line 398
    invoke-interface {p1, p2, p3}, Lokio/f;->Y(J)V

    goto :goto_54

    .line 403
    :cond_60
    iget-object v0, p0, Lokhttp3/internal/http2/r;->byK:Lokio/d;

    invoke-interface {p1, v0, p2, p3}, Lokio/f;->read(Lokio/d;J)J

    move-result-wide v4

    .line 404
    const-wide/16 v6, -0x1

    cmp-long v0, v4, v6

    if-nez v0, :cond_16

    new-instance v0, Ljava/io/EOFException;

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

    throw v0

    :cond_72
    move v0, v2

    .line 409
    goto :goto_23

    .line 414
    :catchall_74
    move-exception v0

    :try_start_75
    monitor-exit v3
    :try_end_76
    .catchall {:try_start_75 .. :try_end_76} :catchall_74

    throw v0
.end method

.method public final close()V
    .registers 3

    .prologue
    .line 423
    iget-object v1, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    monitor-enter v1

    .line 424
    const/4 v0, 0x1

    :try_start_4
    iput-boolean v0, p0, Lokhttp3/internal/http2/r;->closed:Z

    .line 425
    iget-object v0, p0, Lokhttp3/internal/http2/r;->byL:Lokio/d;

    invoke-virtual {v0}, Lokio/d;->clear()V

    .line 426
    iget-object v0, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 427
    monitor-exit v1
    :try_end_11
    .catchall {:try_start_4 .. :try_end_11} :catchall_17

    .line 428
    iget-object v0, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

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

    .line 429
    return-void

    .line 427
    :catchall_17
    move-exception v0

    :try_start_18
    monitor-exit v1
    :try_end_19
    .catchall {:try_start_18 .. :try_end_19} :catchall_17

    throw v0
.end method

.method public final read(Lokio/d;J)J
    .registers 12

    .prologue
    const-wide/16 v4, 0x0

    .line 333
    cmp-long v0, p2, v4

    if-gez v0, :cond_1b

    new-instance v0, Ljava/lang/IllegalArgumentException;

    new-instance v1, Ljava/lang/StringBuilder;

    const-string v2, "byteCount < 0: "

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

    invoke-virtual {v1, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v1

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

    move-result-object v1

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

    throw v0

    .line 336
    :cond_1b
    iget-object v2, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    monitor-enter v2

    .line 337
    :try_start_1e
    invoke-direct {p0}, Lokhttp3/internal/http2/r;->Hw()V

    .line 1432
    iget-boolean v0, p0, Lokhttp3/internal/http2/r;->closed:Z

    if-eqz v0, :cond_30

    .line 1433
    new-instance v0, Ljava/io/IOException;

    const-string v1, "stream closed"

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

    throw v0

    .line 351
    :catchall_2d
    move-exception v0

    monitor-exit v2
    :try_end_2f
    .catchall {:try_start_1e .. :try_end_2f} :catchall_2d

    throw v0

    .line 1435
    :cond_30
    :try_start_30
    iget-object v0, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v0, v0, Lokhttp3/internal/http2/p;->errorCode:Lokhttp3/internal/http2/ErrorCode;

    if-eqz v0, :cond_40

    .line 1436
    new-instance v0, Lokhttp3/internal/http2/StreamResetException;

    iget-object v1, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

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

    invoke-direct {v0, v1}, Lokhttp3/internal/http2/StreamResetException;-><init>(Lokhttp3/internal/http2/ErrorCode;)V

    throw v0

    .line 339
    :cond_40
    iget-object v0, p0, Lokhttp3/internal/http2/r;->byL:Lokio/d;

    .line 2067
    iget-wide v0, v0, Lokio/d;->size:J

    .line 339
    cmp-long v0, v0, v4

    if-nez v0, :cond_4c

    const-wide/16 v0, -0x1

    monitor-exit v2

    .line 363
    :goto_4b
    return-wide v0

    .line 342
    :cond_4c
    iget-object v0, p0, Lokhttp3/internal/http2/r;->byL:Lokio/d;

    iget-object v1, p0, Lokhttp3/internal/http2/r;->byL:Lokio/d;

    .line 3067
    iget-wide v4, v1, Lokio/d;->size:J

    .line 342
    invoke-static {p2, p3, v4, v5}, Ljava/lang/Math;->min(JJ)J

    move-result-wide v4

    invoke-virtual {v0, p1, v4, v5}, Lokio/d;->read(Lokio/d;J)J

    move-result-wide v0

    .line 345
    iget-object v3, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-wide v4, v3, Lokhttp3/internal/http2/p;->byb:J

    add-long/2addr v4, v0

    iput-wide v4, v3, Lokhttp3/internal/http2/p;->byb:J

    .line 346
    iget-object v3, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-wide v4, v3, Lokhttp3/internal/http2/p;->byb:J

    iget-object v3, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v3, v3, Lokhttp3/internal/http2/p;->bXL:Lokhttp3/internal/http2/h;

    iget-object v3, v3, Lokhttp3/internal/http2/h;->bXT:Lokhttp3/internal/http2/x;

    .line 347
    invoke-virtual {v3}, Lokhttp3/internal/http2/x;->RW()I

    move-result v3

    div-int/lit8 v3, v3, 0x2

    int-to-long v6, v3

    cmp-long v3, v4, v6

    if-ltz v3, :cond_8b

    .line 348
    iget-object v3, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v3, v3, Lokhttp3/internal/http2/p;->bXL:Lokhttp3/internal/http2/h;

    iget-object v4, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget v4, v4, Lokhttp3/internal/http2/p;->id:I

    iget-object v5, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-wide v6, v5, Lokhttp3/internal/http2/p;->byb:J

    invoke-virtual {v3, v4, v6, v7}, Lokhttp3/internal/http2/h;->g(IJ)V

    .line 349
    iget-object v3, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    const-wide/16 v4, 0x0

    iput-wide v4, v3, Lokhttp3/internal/http2/p;->byb:J

    .line 351
    :cond_8b
    monitor-exit v2
    :try_end_8c
    .catchall {:try_start_30 .. :try_end_8c} :catchall_2d

    .line 354
    iget-object v2, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v2, v2, Lokhttp3/internal/http2/p;->bXL:Lokhttp3/internal/http2/h;

    monitor-enter v2

    .line 355
    :try_start_91
    iget-object v3, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v3, v3, Lokhttp3/internal/http2/p;->bXL:Lokhttp3/internal/http2/h;

    iget-wide v4, v3, Lokhttp3/internal/http2/h;->byb:J

    add-long/2addr v4, v0

    iput-wide v4, v3, Lokhttp3/internal/http2/h;->byb:J

    .line 356
    iget-object v3, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v3, v3, Lokhttp3/internal/http2/p;->bXL:Lokhttp3/internal/http2/h;

    iget-wide v4, v3, Lokhttp3/internal/http2/h;->byb:J

    iget-object v3, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v3, v3, Lokhttp3/internal/http2/p;->bXL:Lokhttp3/internal/http2/h;

    iget-object v3, v3, Lokhttp3/internal/http2/h;->bXT:Lokhttp3/internal/http2/x;

    .line 357
    invoke-virtual {v3}, Lokhttp3/internal/http2/x;->RW()I

    move-result v3

    div-int/lit8 v3, v3, 0x2

    int-to-long v6, v3

    cmp-long v3, v4, v6

    if-ltz v3, :cond_c7

    .line 358
    iget-object v3, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v3, v3, Lokhttp3/internal/http2/p;->bXL:Lokhttp3/internal/http2/h;

    const/4 v4, 0x0

    iget-object v5, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v5, v5, Lokhttp3/internal/http2/p;->bXL:Lokhttp3/internal/http2/h;

    iget-wide v6, v5, Lokhttp3/internal/http2/h;->byb:J

    invoke-virtual {v3, v4, v6, v7}, Lokhttp3/internal/http2/h;->g(IJ)V

    .line 359
    iget-object v3, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v3, v3, Lokhttp3/internal/http2/p;->bXL:Lokhttp3/internal/http2/h;

    const-wide/16 v4, 0x0

    iput-wide v4, v3, Lokhttp3/internal/http2/h;->byb:J

    .line 361
    :cond_c7
    monitor-exit v2

    goto :goto_4b

    :catchall_c9
    move-exception v0

    monitor-exit v2
    :try_end_cb
    .catchall {:try_start_91 .. :try_end_cb} :catchall_c9

    throw v0
.end method

.method public final timeout()Lokio/t;
    .registers 2

    .prologue
    .line 419
    iget-object v0, p0, Lokhttp3/internal/http2/r;->bYp:Lokhttp3/internal/http2/p;

    iget-object v0, v0, Lokhttp3/internal/http2/p;->bYn:Lokhttp3/internal/http2/s;

    return-object v0
.end method