Http2Stream$FramingSource.smali
.class final Lokhttp3/internal/http2/Http2Stream$FramingSource;
.super Ljava/lang/Object;
.source "Http2Stream.java"
# interfaces
.implements Lokio/Source;
# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
value = Lokhttp3/internal/http2/Http2Stream;
.end annotation
.annotation system Ldalvik/annotation/InnerClass;
accessFlags = 0x12
name = "FramingSource"
.end annotation
# static fields
.field static final synthetic $assertionsDisabled:Z
# instance fields
.field closed:Z
.field finished:Z
.field private final maxByteCount:J
.field private final readBuffer:Lokio/Buffer;
.field private final receiveBuffer:Lokio/Buffer;
.field final synthetic this$0:Lokhttp3/internal/http2/Http2Stream;
# direct methods
.method static constructor <clinit>()V
.registers 1
.line 320
const-class v0, Lokhttp3/internal/http2/Http2Stream;
return-void
.end method
.method constructor <init>(Lokhttp3/internal/http2/Http2Stream;J)V
.registers 4
.param p2, "maxByteCount" # J
.line 339
iput-object p1, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 322
new-instance p1, Lokio/Buffer;
invoke-direct {p1}, Lokio/Buffer;-><init>()V
iput-object p1, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->receiveBuffer:Lokio/Buffer;
.line 325
new-instance p1, Lokio/Buffer;
invoke-direct {p1}, Lokio/Buffer;-><init>()V
iput-object p1, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->readBuffer:Lokio/Buffer;
.line 340
iput-wide p2, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->maxByteCount:J
.line 341
return-void
.end method
.method private updateConnectionFlowControl(J)V
.registers 4
.param p1, "read" # J
.line 388
nop
.line 389
iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget-object v0, v0, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
invoke-virtual {v0, p1, p2}, Lokhttp3/internal/http2/Http2Connection;->updateConnectionFlowControl(J)V
.line 390
return-void
.end method
.method private waitUntilReadable()V
.registers 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 394
iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget-object v0, v0, Lokhttp3/internal/http2/Http2Stream;->readTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Stream$StreamTimeout;->enter()V
.line 396
:goto_7
:try_start_7
iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->readBuffer:Lokio/Buffer;
invoke-virtual {v0}, Lokio/Buffer;->size()J
move-result-wide v0
const-wide/16 v2, 0x0
cmp-long v4, v0, v2
if-nez v4, :cond_27
iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->finished:Z
if-nez v0, :cond_27
iget-boolean v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->closed:Z
if-nez v0, :cond_27
iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget-object v0, v0, Lokhttp3/internal/http2/Http2Stream;->errorCode:Lokhttp3/internal/http2/ErrorCode;
if-nez v0, :cond_27
.line 397
iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Stream;->waitForIo()V
:try_end_26
.catchall {:try_start_7 .. :try_end_26} :catchall_30
goto :goto_7
.line 400
:cond_27
iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget-object v0, v0, Lokhttp3/internal/http2/Http2Stream;->readTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Stream$StreamTimeout;->exitAndThrowIfTimedOut()V
.line 401
nop
.line 402
return-void
.line 400
:catchall_30
move-exception v0
iget-object v1, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget-object v1, v1, Lokhttp3/internal/http2/Http2Stream;->readTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
invoke-virtual {v1}, Lokhttp3/internal/http2/Http2Stream$StreamTimeout;->exitAndThrowIfTimedOut()V
goto :goto_3a
:goto_39
throw v0
:goto_3a
goto :goto_39
.end method
# virtual methods
.method public close()V
.registers 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 450
iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
monitor-enter v0
.line 451
const/4 v1, 0x1
:try_start_4
iput-boolean v1, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->closed:Z
.line 452
iget-object v1, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->readBuffer:Lokio/Buffer;
invoke-virtual {v1}, Lokio/Buffer;->size()J
move-result-wide v1
.line 453
.local v1, "bytesDiscarded":J
iget-object v3, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->readBuffer:Lokio/Buffer;
invoke-virtual {v3}, Lokio/Buffer;->clear()V
.line 454
iget-object v3, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
invoke-virtual {v3}, Ljava/lang/Object;->notifyAll()V
.line 455
monitor-exit v0
:try_end_17
.catchall {:try_start_4 .. :try_end_17} :catchall_26
.line 456
const-wide/16 v3, 0x0
cmp-long v0, v1, v3
if-lez v0, :cond_20
.line 457
invoke-direct {p0, v1, v2}, Lokhttp3/internal/http2/Http2Stream$FramingSource;->updateConnectionFlowControl(J)V
.line 459
:cond_20
iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Stream;->cancelStreamIfNecessary()V
.line 460
return-void
.line 455
.end local v1 # "bytesDiscarded":J
:catchall_26
move-exception v1
:try_start_27
monitor-exit v0
:try_end_28
.catchall {:try_start_27 .. :try_end_28} :catchall_26
throw v1
.end method
.method public read(Lokio/Buffer;J)J
.registers 15
.param p1, "sink" # Lokio/Buffer;
.param p2, "byteCount" # J
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 344
const-wide/16 v0, 0x0
cmp-long v2, p2, v0
if-ltz v2, :cond_81
.line 346
const-wide/16 v2, -0x1
.line 348
.local v2, "read":J
iget-object v4, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
monitor-enter v4
.line 349
:try_start_b
invoke-direct {p0}, Lokhttp3/internal/http2/Http2Stream$FramingSource;->waitUntilReadable()V
.line 350
iget-boolean v5, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->closed:Z
if-nez v5, :cond_76
.line 353
iget-object v5, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget-object v5, v5, Lokhttp3/internal/http2/Http2Stream;->errorCode:Lokhttp3/internal/http2/ErrorCode;
.line 355
.local v5, "errorCode":Lokhttp3/internal/http2/ErrorCode;
iget-object v6, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->readBuffer:Lokio/Buffer;
invoke-virtual {v6}, Lokio/Buffer;->size()J
move-result-wide v6
cmp-long v8, v6, v0
if-lez v8, :cond_38
.line 357
iget-object v6, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->readBuffer:Lokio/Buffer;
iget-object v7, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->readBuffer:Lokio/Buffer;
invoke-virtual {v7}, Lokio/Buffer;->size()J
move-result-wide v7
invoke-static {p2, p3, v7, v8}, Ljava/lang/Math;->min(JJ)J
move-result-wide v7
invoke-virtual {v6, p1, v7, v8}, Lokio/Buffer;->read(Lokio/Buffer;J)J
move-result-wide v6
move-wide v2, v6
.line 358
iget-object v6, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget-wide v7, v6, Lokhttp3/internal/http2/Http2Stream;->unacknowledgedBytesRead:J
add-long/2addr v7, v2
iput-wide v7, v6, Lokhttp3/internal/http2/Http2Stream;->unacknowledgedBytesRead:J
.line 361
:cond_38
if-nez v5, :cond_62
iget-object v6, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget-wide v6, v6, Lokhttp3/internal/http2/Http2Stream;->unacknowledgedBytesRead:J
iget-object v8, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget-object v8, v8, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
iget-object v8, v8, Lokhttp3/internal/http2/Http2Connection;->okHttpSettings:Lokhttp3/internal/http2/Settings;
.line 362
invoke-virtual {v8}, Lokhttp3/internal/http2/Settings;->getInitialWindowSize()I
move-result v8
div-int/lit8 v8, v8, 0x2
int-to-long v8, v8
cmp-long v10, v6, v8
if-ltz v10, :cond_62
.line 365
iget-object v6, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget-object v6, v6, Lokhttp3/internal/http2/Http2Stream;->connection:Lokhttp3/internal/http2/Http2Connection;
iget-object v7, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget v7, v7, Lokhttp3/internal/http2/Http2Stream;->id:I
iget-object v8, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget-wide v8, v8, Lokhttp3/internal/http2/Http2Stream;->unacknowledgedBytesRead:J
invoke-virtual {v6, v7, v8, v9}, Lokhttp3/internal/http2/Http2Connection;->writeWindowUpdateLater(IJ)V
.line 366
iget-object v6, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iput-wide v0, v6, Lokhttp3/internal/http2/Http2Stream;->unacknowledgedBytesRead:J
.line 368
:cond_62
monitor-exit v4
:try_end_63
.catchall {:try_start_b .. :try_end_63} :catchall_7e
.line 370
const-wide/16 v0, -0x1
cmp-long v4, v2, v0
if-eqz v4, :cond_6d
.line 372
invoke-direct {p0, v2, v3}, Lokhttp3/internal/http2/Http2Stream$FramingSource;->updateConnectionFlowControl(J)V
.line 373
return-wide v2
.line 376
:cond_6d
if-nez v5, :cond_70
.line 384
return-wide v0
.line 381
:cond_70
new-instance v0, Lokhttp3/internal/http2/StreamResetException;
invoke-direct {v0, v5}, Lokhttp3/internal/http2/StreamResetException;-><init>(Lokhttp3/internal/http2/ErrorCode;)V
throw v0
.line 351
.end local v5 # "errorCode":Lokhttp3/internal/http2/ErrorCode;
:cond_76
:try_start_76
new-instance v0, Ljava/io/IOException;
const-string v1, "stream closed"
invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
.end local v2 # "read":J
.end local p1 # "sink":Lokio/Buffer;
.end local p2 # "byteCount":J
throw v0
.line 368
.restart local v2 # "read":J
.restart local p1 # "sink":Lokio/Buffer;
.restart local p2 # "byteCount":J
:catchall_7e
move-exception v0
monitor-exit v4
:try_end_80
.catchall {:try_start_76 .. :try_end_80} :catchall_7e
throw v0
.line 344
.end local v2 # "read":J
:cond_81
new-instance v0, Ljava/lang/IllegalArgumentException;
new-instance v1, Ljava/lang/StringBuilder;
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
const-string v2, "byteCount < 0: "
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
invoke-virtual {v1, p2, p3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;
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
.end method
.method receive(Lokio/BufferedSource;J)V
.registers 16
.param p1, "in" # Lokio/BufferedSource;
.param p2, "byteCount" # J
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 405
nop
.line 407
:goto_1
const-wide/16 v0, 0x0
cmp-long v2, p2, v0
if-lez v2, :cond_6d
.line 410
iget-object v2, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
monitor-enter v2
.line 411
:try_start_a
iget-boolean v3, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->finished:Z
.line 412
.local v3, "finished":Z
iget-object v4, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->readBuffer:Lokio/Buffer;
invoke-virtual {v4}, Lokio/Buffer;->size()J
move-result-wide v4
add-long/2addr v4, p2
iget-wide v6, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->maxByteCount:J
const/4 v8, 0x1
const/4 v9, 0x0
cmp-long v10, v4, v6
if-lez v10, :cond_1d
const/4 v4, 0x1
goto :goto_1e
:cond_1d
const/4 v4, 0x0
.line 413
.local v4, "flowControlError":Z
:goto_1e
monitor-exit v2
:try_end_1f
.catchall {:try_start_a .. :try_end_1f} :catchall_6a
.line 416
if-eqz v4, :cond_2c
.line 417
invoke-interface {p1, p2, p3}, Lokio/BufferedSource;->skip(J)V
.line 418
iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
sget-object v1, Lokhttp3/internal/http2/ErrorCode;->FLOW_CONTROL_ERROR:Lokhttp3/internal/http2/ErrorCode;
invoke-virtual {v0, v1}, Lokhttp3/internal/http2/Http2Stream;->closeLater(Lokhttp3/internal/http2/ErrorCode;)V
.line 419
return-void
.line 423
:cond_2c
if-eqz v3, :cond_32
.line 424
invoke-interface {p1, p2, p3}, Lokio/BufferedSource;->skip(J)V
.line 425
return-void
.line 429
:cond_32
iget-object v2, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->receiveBuffer:Lokio/Buffer;
invoke-interface {p1, v2, p2, p3}, Lokio/BufferedSource;->read(Lokio/Buffer;J)J
move-result-wide v5
.line 430
.local v5, "read":J
const-wide/16 v10, -0x1
cmp-long v2, v5, v10
if-eqz v2, :cond_64
.line 431
sub-long v10, p2, v5
.line 434
.end local p2 # "byteCount":J
.local v10, "byteCount":J
iget-object v2, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
monitor-enter v2
.line 435
:try_start_43
iget-object p2, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->readBuffer:Lokio/Buffer;
invoke-virtual {p2}, Lokio/Buffer;->size()J
move-result-wide p2
cmp-long v7, p2, v0
if-nez v7, :cond_4e
goto :goto_4f
:cond_4e
const/4 v8, 0x0
:goto_4f
move p2, v8
.line 436
.local p2, "wasEmpty":Z
iget-object p3, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->readBuffer:Lokio/Buffer;
iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->receiveBuffer:Lokio/Buffer;
invoke-virtual {p3, v0}, Lokio/Buffer;->writeAll(Lokio/Source;)J
.line 437
if-eqz p2, :cond_5e
.line 438
iget-object p3, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
invoke-virtual {p3}, Ljava/lang/Object;->notifyAll()V
.line 440
.end local p2 # "wasEmpty":Z
:cond_5e
monitor-exit v2
.line 441
.end local v3 # "finished":Z
.end local v4 # "flowControlError":Z
.end local v5 # "read":J
move-wide p2, v10
goto :goto_1
.line 440
.restart local v3 # "finished":Z
.restart local v4 # "flowControlError":Z
.restart local v5 # "read":J
:catchall_61
move-exception p2
monitor-exit v2
:try_end_63
.catchall {:try_start_43 .. :try_end_63} :catchall_61
throw p2
.line 430
.end local v10 # "byteCount":J
.local p2, "byteCount":J
:cond_64
new-instance v0, Ljava/io/EOFException;
invoke-direct {v0}, Ljava/io/EOFException;-><init>()V
throw v0
.line 413
.end local v3 # "finished":Z
.end local v4 # "flowControlError":Z
.end local v5 # "read":J
:catchall_6a
move-exception v0
:try_start_6b
monitor-exit v2
:try_end_6c
.catchall {:try_start_6b .. :try_end_6c} :catchall_6a
throw v0
.line 442
:cond_6d
return-void
.end method
.method public timeout()Lokio/Timeout;
.registers 2
.line 445
iget-object v0, p0, Lokhttp3/internal/http2/Http2Stream$FramingSource;->this$0:Lokhttp3/internal/http2/Http2Stream;
iget-object v0, v0, Lokhttp3/internal/http2/Http2Stream;->readTimeout:Lokhttp3/internal/http2/Http2Stream$StreamTimeout;
return-object v0
.end method