Rabbit-R1/android (non root)/smali/smali_classes3/okhttp3/internal/ws/WebSocketReader.smali
2024-05-21 17:08:36 -04:00

1152 lines
30 KiB
Smali

.class public final Lokhttp3/internal/ws/WebSocketReader;
.super Ljava/lang/Object;
.source "WebSocketReader.kt"
# interfaces
.implements Ljava/io/Closeable;
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lokhttp3/internal/ws/WebSocketReader$FrameCallback;
}
.end annotation
.annotation system Ldalvik/annotation/SourceDebugExtension;
value = "SMAP\nWebSocketReader.kt\nKotlin\n*S Kotlin\n*F\n+ 1 WebSocketReader.kt\nokhttp3/internal/ws/WebSocketReader\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,298:1\n1#2:299\n*E\n"
.end annotation
.annotation runtime Lkotlin/Metadata;
bv = {
0x1,
0x0,
0x3
}
d1 = {
"\u0000P\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u000b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0008\u0005\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\u0008\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0012\n\u0002\u0008\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u0008\n\u0002\u0008\u0004\n\u0002\u0010\u0002\n\u0002\u0008\u0008\u0018\u00002\u00020\u0001:\u0001&B-\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u0012\u0006\u0010\u0006\u001a\u00020\u0007\u0012\u0006\u0010\u0008\u001a\u00020\u0003\u0012\u0006\u0010\t\u001a\u00020\u0003\u00a2\u0006\u0002\u0010\nJ\u0008\u0010\u001e\u001a\u00020\u001fH\u0016J\u0006\u0010 \u001a\u00020\u001fJ\u0008\u0010!\u001a\u00020\u001fH\u0002J\u0008\u0010\"\u001a\u00020\u001fH\u0002J\u0008\u0010#\u001a\u00020\u001fH\u0002J\u0008\u0010$\u001a\u00020\u001fH\u0002J\u0008\u0010%\u001a\u00020\u001fH\u0002R\u000e\u0010\u000b\u001a\u00020\u0003X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u000c\u001a\u00020\rX\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0006\u001a\u00020\u0007X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u000e\u001a\u00020\u000fX\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0002\u001a\u00020\u0003X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0010\u001a\u00020\u0003X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0011\u001a\u00020\u0003X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u0010\u0010\u0012\u001a\u0004\u0018\u00010\u0013X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u0010\u0010\u0014\u001a\u0004\u0018\u00010\u0015X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0016\u001a\u00020\rX\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u0010\u0010\u0017\u001a\u0004\u0018\u00010\u0018X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\u0003X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0019\u001a\u00020\u001aX\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u0008\u001a\u00020\u0003X\u0082\u0004\u00a2\u0006\u0002\n\u0000R\u000e\u0010\u001b\u001a\u00020\u0003X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u0011\u0010\u0004\u001a\u00020\u0005\u00a2\u0006\u0008\n\u0000\u001a\u0004\u0008\u001c\u0010\u001d\u00a8\u0006\'"
}
d2 = {
"Lokhttp3/internal/ws/WebSocketReader;",
"Ljava/io/Closeable;",
"isClient",
"",
"source",
"Lokio/BufferedSource;",
"frameCallback",
"Lokhttp3/internal/ws/WebSocketReader$FrameCallback;",
"perMessageDeflate",
"noContextTakeover",
"(ZLokio/BufferedSource;Lokhttp3/internal/ws/WebSocketReader$FrameCallback;ZZ)V",
"closed",
"controlFrameBuffer",
"Lokio/Buffer;",
"frameLength",
"",
"isControlFrame",
"isFinalFrame",
"maskCursor",
"Lokio/Buffer$UnsafeCursor;",
"maskKey",
"",
"messageFrameBuffer",
"messageInflater",
"Lokhttp3/internal/ws/MessageInflater;",
"opcode",
"",
"readingCompressedMessage",
"getSource",
"()Lokio/BufferedSource;",
"close",
"",
"processNextFrame",
"readControlFrame",
"readHeader",
"readMessage",
"readMessageFrame",
"readUntilNonControlFrame",
"FrameCallback",
"okhttp"
}
k = 0x1
mv = {
0x1,
0x4,
0x0
}
.end annotation
# instance fields
.field private closed:Z
.field private final controlFrameBuffer:Lokio/Buffer;
.field private final frameCallback:Lokhttp3/internal/ws/WebSocketReader$FrameCallback;
.field private frameLength:J
.field private final isClient:Z
.field private isControlFrame:Z
.field private isFinalFrame:Z
.field private final maskCursor:Lokio/Buffer$UnsafeCursor;
.field private final maskKey:[B
.field private final messageFrameBuffer:Lokio/Buffer;
.field private messageInflater:Lokhttp3/internal/ws/MessageInflater;
.field private final noContextTakeover:Z
.field private opcode:I
.field private final perMessageDeflate:Z
.field private readingCompressedMessage:Z
.field private final source:Lokio/BufferedSource;
# direct methods
.method public constructor <init>(ZLokio/BufferedSource;Lokhttp3/internal/ws/WebSocketReader$FrameCallback;ZZ)V
.locals 1
const-string v0, "source"
invoke-static {p2, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
const-string v0, "frameCallback"
invoke-static {p3, v0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNullParameter(Ljava/lang/Object;Ljava/lang/String;)V
.line 54
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
iput-boolean p1, p0, Lokhttp3/internal/ws/WebSocketReader;->isClient:Z
iput-object p2, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
iput-object p3, p0, Lokhttp3/internal/ws/WebSocketReader;->frameCallback:Lokhttp3/internal/ws/WebSocketReader$FrameCallback;
iput-boolean p4, p0, Lokhttp3/internal/ws/WebSocketReader;->perMessageDeflate:Z
iput-boolean p5, p0, Lokhttp3/internal/ws/WebSocketReader;->noContextTakeover:Z
.line 70
new-instance p2, Lokio/Buffer;
invoke-direct {p2}, Lokio/Buffer;-><init>()V
iput-object p2, p0, Lokhttp3/internal/ws/WebSocketReader;->controlFrameBuffer:Lokio/Buffer;
.line 71
new-instance p2, Lokio/Buffer;
invoke-direct {p2}, Lokio/Buffer;-><init>()V
iput-object p2, p0, Lokhttp3/internal/ws/WebSocketReader;->messageFrameBuffer:Lokio/Buffer;
const/4 p2, 0x0
if-eqz p1, :cond_0
move-object p3, p2
goto :goto_0
:cond_0
const/4 p3, 0x4
new-array p3, p3, [B
:goto_0
iput-object p3, p0, Lokhttp3/internal/ws/WebSocketReader;->maskKey:[B
if-eqz p1, :cond_1
goto :goto_1
.line 78
:cond_1
new-instance p2, Lokio/Buffer$UnsafeCursor;
invoke-direct {p2}, Lokio/Buffer$UnsafeCursor;-><init>()V
:goto_1
iput-object p2, p0, Lokhttp3/internal/ws/WebSocketReader;->maskCursor:Lokio/Buffer$UnsafeCursor;
return-void
.end method
.method private final readControlFrame()V
.locals 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-wide v0, p0, Lokhttp3/internal/ws/WebSocketReader;->frameLength:J
const-wide/16 v2, 0x0
cmp-long v4, v0, v2
if-lez v4, :cond_0
iget-object v4, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
iget-object v5, p0, Lokhttp3/internal/ws/WebSocketReader;->controlFrameBuffer:Lokio/Buffer;
.line 191
invoke-interface {v4, v5, v0, v1}, Lokio/BufferedSource;->readFully(Lokio/Buffer;J)V
iget-boolean v0, p0, Lokhttp3/internal/ws/WebSocketReader;->isClient:Z
if-nez v0, :cond_0
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->controlFrameBuffer:Lokio/Buffer;
iget-object v1, p0, Lokhttp3/internal/ws/WebSocketReader;->maskCursor:Lokio/Buffer$UnsafeCursor;
.line 194
invoke-static {v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V
invoke-virtual {v0, v1}, Lokio/Buffer;->readAndWriteUnsafe(Lokio/Buffer$UnsafeCursor;)Lokio/Buffer$UnsafeCursor;
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->maskCursor:Lokio/Buffer$UnsafeCursor;
.line 195
invoke-virtual {v0, v2, v3}, Lokio/Buffer$UnsafeCursor;->seek(J)I
.line 196
sget-object v0, Lokhttp3/internal/ws/WebSocketProtocol;->INSTANCE:Lokhttp3/internal/ws/WebSocketProtocol;
iget-object v1, p0, Lokhttp3/internal/ws/WebSocketReader;->maskCursor:Lokio/Buffer$UnsafeCursor;
iget-object v4, p0, Lokhttp3/internal/ws/WebSocketReader;->maskKey:[B
invoke-static {v4}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V
invoke-virtual {v0, v1, v4}, Lokhttp3/internal/ws/WebSocketProtocol;->toggleMask(Lokio/Buffer$UnsafeCursor;[B)V
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->maskCursor:Lokio/Buffer$UnsafeCursor;
.line 197
invoke-virtual {v0}, Lokio/Buffer$UnsafeCursor;->close()V
:cond_0
iget v0, p0, Lokhttp3/internal/ws/WebSocketReader;->opcode:I
packed-switch v0, :pswitch_data_0
.line 224
new-instance v0, Ljava/net/ProtocolException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Unknown control opcode: "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
iget p0, p0, Lokhttp3/internal/ws/WebSocketReader;->opcode:I
invoke-static {p0}, Lokhttp3/internal/Util;->toHexString(I)Ljava/lang/String;
move-result-object p0
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
invoke-direct {v0, p0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast v0, Ljava/lang/Throwable;
throw v0
:pswitch_0
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->frameCallback:Lokhttp3/internal/ws/WebSocketReader$FrameCallback;
iget-object p0, p0, Lokhttp3/internal/ws/WebSocketReader;->controlFrameBuffer:Lokio/Buffer;
.line 206
invoke-virtual {p0}, Lokio/Buffer;->readByteString()Lokio/ByteString;
move-result-object p0
invoke-interface {v0, p0}, Lokhttp3/internal/ws/WebSocketReader$FrameCallback;->onReadPong(Lokio/ByteString;)V
goto :goto_1
:pswitch_1
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->frameCallback:Lokhttp3/internal/ws/WebSocketReader$FrameCallback;
iget-object p0, p0, Lokhttp3/internal/ws/WebSocketReader;->controlFrameBuffer:Lokio/Buffer;
.line 203
invoke-virtual {p0}, Lokio/Buffer;->readByteString()Lokio/ByteString;
move-result-object p0
invoke-interface {v0, p0}, Lokhttp3/internal/ws/WebSocketReader$FrameCallback;->onReadPing(Lokio/ByteString;)V
goto :goto_1
:pswitch_2
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->controlFrameBuffer:Lokio/Buffer;
.line 211
invoke-virtual {v0}, Lokio/Buffer;->size()J
move-result-wide v0
const-wide/16 v4, 0x1
cmp-long v4, v0, v4
if-eqz v4, :cond_3
cmp-long v0, v0, v2
if-eqz v0, :cond_2
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->controlFrameBuffer:Lokio/Buffer;
.line 215
invoke-virtual {v0}, Lokio/Buffer;->readShort()S
move-result v0
iget-object v1, p0, Lokhttp3/internal/ws/WebSocketReader;->controlFrameBuffer:Lokio/Buffer;
.line 216
invoke-virtual {v1}, Lokio/Buffer;->readUtf8()Ljava/lang/String;
move-result-object v1
.line 217
sget-object v2, Lokhttp3/internal/ws/WebSocketProtocol;->INSTANCE:Lokhttp3/internal/ws/WebSocketProtocol;
invoke-virtual {v2, v0}, Lokhttp3/internal/ws/WebSocketProtocol;->closeCodeExceptionMessage(I)Ljava/lang/String;
move-result-object v2
if-nez v2, :cond_1
goto :goto_0
.line 218
:cond_1
new-instance p0, Ljava/net/ProtocolException;
invoke-direct {p0, v2}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
:cond_2
const/16 v0, 0x3ed
const-string v1, ""
:goto_0
iget-object v2, p0, Lokhttp3/internal/ws/WebSocketReader;->frameCallback:Lokhttp3/internal/ws/WebSocketReader$FrameCallback;
.line 220
invoke-interface {v2, v0, v1}, Lokhttp3/internal/ws/WebSocketReader$FrameCallback;->onReadClose(ILjava/lang/String;)V
const/4 v0, 0x1
iput-boolean v0, p0, Lokhttp3/internal/ws/WebSocketReader;->closed:Z
:goto_1
return-void
.line 213
:cond_3
new-instance p0, Ljava/net/ProtocolException;
const-string v0, "Malformed close payload length of 1."
invoke-direct {p0, v0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
nop
:pswitch_data_0
.packed-switch 0x8
:pswitch_2
:pswitch_1
:pswitch_0
.end packed-switch
.end method
.method private final readHeader()V
.locals 8
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Ljava/net/ProtocolException;
}
.end annotation
iget-boolean v0, p0, Lokhttp3/internal/ws/WebSocketReader;->closed:Z
if-nez v0, :cond_14
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
.line 116
invoke-interface {v0}, Lokio/BufferedSource;->timeout()Lokio/Timeout;
move-result-object v0
invoke-virtual {v0}, Lokio/Timeout;->timeoutNanos()J
move-result-wide v0
iget-object v2, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
.line 117
invoke-interface {v2}, Lokio/BufferedSource;->timeout()Lokio/Timeout;
move-result-object v2
invoke-virtual {v2}, Lokio/Timeout;->clearTimeout()Lokio/Timeout;
:try_start_0
iget-object v2, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
.line 119
invoke-interface {v2}, Lokio/BufferedSource;->readByte()B
move-result v2
const/16 v3, 0xff
invoke-static {v2, v3}, Lokhttp3/internal/Util;->and(BI)I
move-result v2
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
iget-object v4, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
.line 121
invoke-interface {v4}, Lokio/BufferedSource;->timeout()Lokio/Timeout;
move-result-object v4
sget-object v5, Ljava/util/concurrent/TimeUnit;->NANOSECONDS:Ljava/util/concurrent/TimeUnit;
invoke-virtual {v4, v0, v1, v5}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout;
and-int/lit8 v0, v2, 0xf
iput v0, p0, Lokhttp3/internal/ws/WebSocketReader;->opcode:I
and-int/lit16 v1, v2, 0x80
const/4 v4, 0x0
const/4 v5, 0x1
if-eqz v1, :cond_0
move v1, v5
goto :goto_0
:cond_0
move v1, v4
:goto_0
iput-boolean v1, p0, Lokhttp3/internal/ws/WebSocketReader;->isFinalFrame:Z
and-int/lit8 v6, v2, 0x8
if-eqz v6, :cond_1
move v6, v5
goto :goto_1
:cond_1
move v6, v4
:goto_1
iput-boolean v6, p0, Lokhttp3/internal/ws/WebSocketReader;->isControlFrame:Z
if-eqz v6, :cond_3
if-eqz v1, :cond_2
goto :goto_2
.line 130
:cond_2
new-instance p0, Ljava/net/ProtocolException;
const-string v0, "Control frames must be final."
invoke-direct {p0, v0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
:cond_3
:goto_2
and-int/lit8 v1, v2, 0x40
if-eqz v1, :cond_4
move v1, v5
goto :goto_3
:cond_4
move v1, v4
:goto_3
const-string v6, "Unexpected rsv1 flag"
if-eq v0, v5, :cond_6
const/4 v7, 0x2
if-eq v0, v7, :cond_6
if-nez v1, :cond_5
goto :goto_5
.line 144
:cond_5
new-instance p0, Ljava/net/ProtocolException;
invoke-direct {p0, v6}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
:cond_6
if-eqz v1, :cond_8
iget-boolean v0, p0, Lokhttp3/internal/ws/WebSocketReader;->perMessageDeflate:Z
if-eqz v0, :cond_7
move v0, v5
goto :goto_4
.line 137
:cond_7
new-instance p0, Ljava/net/ProtocolException;
invoke-direct {p0, v6}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
:cond_8
move v0, v4
:goto_4
iput-boolean v0, p0, Lokhttp3/internal/ws/WebSocketReader;->readingCompressedMessage:Z
:goto_5
and-int/lit8 v0, v2, 0x20
if-nez v0, :cond_13
and-int/lit8 v0, v2, 0x10
if-nez v0, :cond_12
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
.line 154
invoke-interface {v0}, Lokio/BufferedSource;->readByte()B
move-result v0
invoke-static {v0, v3}, Lokhttp3/internal/Util;->and(BI)I
move-result v0
and-int/lit16 v1, v0, 0x80
if-eqz v1, :cond_9
move v4, v5
:cond_9
iget-boolean v1, p0, Lokhttp3/internal/ws/WebSocketReader;->isClient:Z
if-ne v4, v1, :cond_b
.line 159
new-instance v0, Ljava/net/ProtocolException;
iget-boolean p0, p0, Lokhttp3/internal/ws/WebSocketReader;->isClient:Z
if-eqz p0, :cond_a
const-string p0, "Server-sent frames must not be masked."
goto :goto_6
:cond_a
const-string p0, "Client-sent frames must be masked."
:goto_6
invoke-direct {v0, p0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast v0, Ljava/lang/Throwable;
throw v0
:cond_b
const/16 v1, 0x7f
and-int/2addr v0, v1
int-to-long v2, v0
iput-wide v2, p0, Lokhttp3/internal/ws/WebSocketReader;->frameLength:J
const/16 v0, 0x7e
int-to-long v5, v0
cmp-long v0, v2, v5
if-nez v0, :cond_c
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
.line 169
invoke-interface {v0}, Lokio/BufferedSource;->readShort()S
move-result v0
const v1, 0xffff
invoke-static {v0, v1}, Lokhttp3/internal/Util;->and(SI)I
move-result v0
int-to-long v0, v0
iput-wide v0, p0, Lokhttp3/internal/ws/WebSocketReader;->frameLength:J
goto :goto_7
:cond_c
int-to-long v0, v1
cmp-long v0, v2, v0
if-nez v0, :cond_e
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
.line 171
invoke-interface {v0}, Lokio/BufferedSource;->readLong()J
move-result-wide v0
iput-wide v0, p0, Lokhttp3/internal/ws/WebSocketReader;->frameLength:J
const-wide/16 v2, 0x0
cmp-long v0, v0, v2
if-ltz v0, :cond_d
goto :goto_7
.line 173
:cond_d
new-instance v0, Ljava/net/ProtocolException;
.line 174
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Frame length 0x"
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
iget-wide v2, p0, Lokhttp3/internal/ws/WebSocketReader;->frameLength:J
invoke-static {v2, v3}, Lokhttp3/internal/Util;->toHexString(J)Ljava/lang/String;
move-result-object p0
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
const-string v1, " > 0x7FFFFFFFFFFFFFFF"
invoke-virtual {p0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
.line 173
invoke-direct {v0, p0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast v0, Ljava/lang/Throwable;
throw v0
:cond_e
:goto_7
iget-boolean v0, p0, Lokhttp3/internal/ws/WebSocketReader;->isControlFrame:Z
if-eqz v0, :cond_10
iget-wide v0, p0, Lokhttp3/internal/ws/WebSocketReader;->frameLength:J
const-wide/16 v2, 0x7d
cmp-long v0, v0, v2
if-gtz v0, :cond_f
goto :goto_8
.line 179
:cond_f
new-instance p0, Ljava/net/ProtocolException;
const-string v0, "Control frame must be less than 125B."
invoke-direct {p0, v0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
:cond_10
:goto_8
if-eqz v4, :cond_11
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
iget-object p0, p0, Lokhttp3/internal/ws/WebSocketReader;->maskKey:[B
.line 184
invoke-static {p0}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V
invoke-interface {v0, p0}, Lokio/BufferedSource;->readFully([B)V
:cond_11
return-void
.line 152
:cond_12
new-instance p0, Ljava/net/ProtocolException;
const-string v0, "Unexpected rsv3 flag"
invoke-direct {p0, v0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
.line 149
:cond_13
new-instance p0, Ljava/net/ProtocolException;
const-string v0, "Unexpected rsv2 flag"
invoke-direct {p0, v0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
:catchall_0
move-exception v2
iget-object p0, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
.line 121
invoke-interface {p0}, Lokio/BufferedSource;->timeout()Lokio/Timeout;
move-result-object p0
sget-object v3, Ljava/util/concurrent/TimeUnit;->NANOSECONDS:Ljava/util/concurrent/TimeUnit;
invoke-virtual {p0, v0, v1, v3}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout;
throw v2
.line 112
:cond_14
new-instance p0, Ljava/io/IOException;
const-string v0, "closed"
invoke-direct {p0, v0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
.end method
.method private final readMessage()V
.locals 5
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
:goto_0
iget-boolean v0, p0, Lokhttp3/internal/ws/WebSocketReader;->closed:Z
if-nez v0, :cond_3
iget-wide v0, p0, Lokhttp3/internal/ws/WebSocketReader;->frameLength:J
const-wide/16 v2, 0x0
cmp-long v2, v0, v2
if-lez v2, :cond_0
iget-object v2, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
iget-object v3, p0, Lokhttp3/internal/ws/WebSocketReader;->messageFrameBuffer:Lokio/Buffer;
.line 274
invoke-interface {v2, v3, v0, v1}, Lokio/BufferedSource;->readFully(Lokio/Buffer;J)V
iget-boolean v0, p0, Lokhttp3/internal/ws/WebSocketReader;->isClient:Z
if-nez v0, :cond_0
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->messageFrameBuffer:Lokio/Buffer;
iget-object v1, p0, Lokhttp3/internal/ws/WebSocketReader;->maskCursor:Lokio/Buffer$UnsafeCursor;
.line 277
invoke-static {v1}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V
invoke-virtual {v0, v1}, Lokio/Buffer;->readAndWriteUnsafe(Lokio/Buffer$UnsafeCursor;)Lokio/Buffer$UnsafeCursor;
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->maskCursor:Lokio/Buffer$UnsafeCursor;
iget-object v1, p0, Lokhttp3/internal/ws/WebSocketReader;->messageFrameBuffer:Lokio/Buffer;
.line 278
invoke-virtual {v1}, Lokio/Buffer;->size()J
move-result-wide v1
iget-wide v3, p0, Lokhttp3/internal/ws/WebSocketReader;->frameLength:J
sub-long/2addr v1, v3
invoke-virtual {v0, v1, v2}, Lokio/Buffer$UnsafeCursor;->seek(J)I
.line 279
sget-object v0, Lokhttp3/internal/ws/WebSocketProtocol;->INSTANCE:Lokhttp3/internal/ws/WebSocketProtocol;
iget-object v1, p0, Lokhttp3/internal/ws/WebSocketReader;->maskCursor:Lokio/Buffer$UnsafeCursor;
iget-object v2, p0, Lokhttp3/internal/ws/WebSocketReader;->maskKey:[B
invoke-static {v2}, Lkotlin/jvm/internal/Intrinsics;->checkNotNull(Ljava/lang/Object;)V
invoke-virtual {v0, v1, v2}, Lokhttp3/internal/ws/WebSocketProtocol;->toggleMask(Lokio/Buffer$UnsafeCursor;[B)V
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->maskCursor:Lokio/Buffer$UnsafeCursor;
.line 280
invoke-virtual {v0}, Lokio/Buffer$UnsafeCursor;->close()V
:cond_0
iget-boolean v0, p0, Lokhttp3/internal/ws/WebSocketReader;->isFinalFrame:Z
if-eqz v0, :cond_1
return-void
.line 286
:cond_1
invoke-direct {p0}, Lokhttp3/internal/ws/WebSocketReader;->readUntilNonControlFrame()V
iget v0, p0, Lokhttp3/internal/ws/WebSocketReader;->opcode:I
if-nez v0, :cond_2
goto :goto_0
.line 288
:cond_2
new-instance v0, Ljava/net/ProtocolException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Expected continuation opcode. Got: "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
iget p0, p0, Lokhttp3/internal/ws/WebSocketReader;->opcode:I
invoke-static {p0}, Lokhttp3/internal/Util;->toHexString(I)Ljava/lang/String;
move-result-object p0
invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object p0
invoke-virtual {p0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
invoke-direct {v0, p0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast v0, Ljava/lang/Throwable;
throw v0
.line 271
:cond_3
new-instance p0, Ljava/io/IOException;
const-string v0, "closed"
invoke-direct {p0, v0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
.end method
.method private final readMessageFrame()V
.locals 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget v0, p0, Lokhttp3/internal/ws/WebSocketReader;->opcode:I
const/4 v1, 0x1
if-eq v0, v1, :cond_1
const/4 v2, 0x2
if-ne v0, v2, :cond_0
goto :goto_0
.line 233
:cond_0
new-instance p0, Ljava/net/ProtocolException;
new-instance v1, Ljava/lang/StringBuilder;
const-string v2, "Unknown opcode: "
invoke-direct {v1, v2}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-static {v0}, Lokhttp3/internal/Util;->toHexString(I)Ljava/lang/String;
move-result-object v0
invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-direct {p0, v0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
check-cast p0, Ljava/lang/Throwable;
throw p0
.line 236
:cond_1
:goto_0
invoke-direct {p0}, Lokhttp3/internal/ws/WebSocketReader;->readMessage()V
iget-boolean v2, p0, Lokhttp3/internal/ws/WebSocketReader;->readingCompressedMessage:Z
if-eqz v2, :cond_3
iget-object v2, p0, Lokhttp3/internal/ws/WebSocketReader;->messageInflater:Lokhttp3/internal/ws/MessageInflater;
if-eqz v2, :cond_2
goto :goto_1
.line 240
:cond_2
new-instance v2, Lokhttp3/internal/ws/MessageInflater;
iget-boolean v3, p0, Lokhttp3/internal/ws/WebSocketReader;->noContextTakeover:Z
invoke-direct {v2, v3}, Lokhttp3/internal/ws/MessageInflater;-><init>(Z)V
iput-object v2, p0, Lokhttp3/internal/ws/WebSocketReader;->messageInflater:Lokhttp3/internal/ws/MessageInflater;
:goto_1
iget-object v3, p0, Lokhttp3/internal/ws/WebSocketReader;->messageFrameBuffer:Lokio/Buffer;
.line 241
invoke-virtual {v2, v3}, Lokhttp3/internal/ws/MessageInflater;->inflate(Lokio/Buffer;)V
:cond_3
if-ne v0, v1, :cond_4
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->frameCallback:Lokhttp3/internal/ws/WebSocketReader$FrameCallback;
iget-object p0, p0, Lokhttp3/internal/ws/WebSocketReader;->messageFrameBuffer:Lokio/Buffer;
.line 245
invoke-virtual {p0}, Lokio/Buffer;->readUtf8()Ljava/lang/String;
move-result-object p0
invoke-interface {v0, p0}, Lokhttp3/internal/ws/WebSocketReader$FrameCallback;->onReadMessage(Ljava/lang/String;)V
goto :goto_2
:cond_4
iget-object v0, p0, Lokhttp3/internal/ws/WebSocketReader;->frameCallback:Lokhttp3/internal/ws/WebSocketReader$FrameCallback;
iget-object p0, p0, Lokhttp3/internal/ws/WebSocketReader;->messageFrameBuffer:Lokio/Buffer;
.line 247
invoke-virtual {p0}, Lokio/Buffer;->readByteString()Lokio/ByteString;
move-result-object p0
invoke-interface {v0, p0}, Lokhttp3/internal/ws/WebSocketReader$FrameCallback;->onReadMessage(Lokio/ByteString;)V
:goto_2
return-void
.end method
.method private final readUntilNonControlFrame()V
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
:goto_0
iget-boolean v0, p0, Lokhttp3/internal/ws/WebSocketReader;->closed:Z
if-nez v0, :cond_1
.line 255
invoke-direct {p0}, Lokhttp3/internal/ws/WebSocketReader;->readHeader()V
iget-boolean v0, p0, Lokhttp3/internal/ws/WebSocketReader;->isControlFrame:Z
if-nez v0, :cond_0
goto :goto_1
.line 259
:cond_0
invoke-direct {p0}, Lokhttp3/internal/ws/WebSocketReader;->readControlFrame()V
goto :goto_0
:cond_1
:goto_1
return-void
.end method
# virtual methods
.method public close()V
.locals 0
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
iget-object p0, p0, Lokhttp3/internal/ws/WebSocketReader;->messageInflater:Lokhttp3/internal/ws/MessageInflater;
if-eqz p0, :cond_0
.line 295
invoke-virtual {p0}, Lokhttp3/internal/ws/MessageInflater;->close()V
:cond_0
return-void
.end method
.method public final getSource()Lokio/BufferedSource;
.locals 0
iget-object p0, p0, Lokhttp3/internal/ws/WebSocketReader;->source:Lokio/BufferedSource;
return-object p0
.end method
.method public final processNextFrame()V
.locals 1
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 102
invoke-direct {p0}, Lokhttp3/internal/ws/WebSocketReader;->readHeader()V
iget-boolean v0, p0, Lokhttp3/internal/ws/WebSocketReader;->isControlFrame:Z
if-eqz v0, :cond_0
.line 104
invoke-direct {p0}, Lokhttp3/internal/ws/WebSocketReader;->readControlFrame()V
goto :goto_0
.line 106
:cond_0
invoke-direct {p0}, Lokhttp3/internal/ws/WebSocketReader;->readMessageFrame()V
:goto_0
return-void
.end method