1518 lines
60 KiB
Java
1518 lines
60 KiB
Java
package okhttp3.internal.http2;
|
|
|
|
import java.io.Closeable;
|
|
import java.io.IOException;
|
|
import java.io.InterruptedIOException;
|
|
import java.net.Socket;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.LinkedHashSet;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
import java.util.concurrent.TimeUnit;
|
|
import o.C14866gag;
|
|
import o.C14930gcM;
|
|
import o.C14953gcr;
|
|
import o.C14957gcv;
|
|
import o.C15111ghZ;
|
|
import o.C15155gij;
|
|
import o.C15160gio;
|
|
import o.InterfaceC14890gbN;
|
|
import o.InterfaceC15148gic;
|
|
import o.InterfaceC15149gid;
|
|
import okhttp3.internal.Util;
|
|
import okhttp3.internal.concurrent.Task;
|
|
import okhttp3.internal.concurrent.TaskQueue;
|
|
import okhttp3.internal.concurrent.TaskQueue$execute$1;
|
|
import okhttp3.internal.concurrent.TaskRunner;
|
|
import okhttp3.internal.http2.Http2Connection;
|
|
import okhttp3.internal.http2.Http2Reader;
|
|
import okhttp3.internal.platform.Platform;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class Http2Connection implements Closeable {
|
|
public static final int AWAIT_PING = 3;
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final Settings DEFAULT_SETTINGS;
|
|
public static final int DEGRADED_PING = 2;
|
|
public static final int DEGRADED_PONG_TIMEOUT_NS = 1000000000;
|
|
public static final int INTERVAL_PING = 1;
|
|
public static final int OKHTTP_CLIENT_WINDOW_SIZE = 16777216;
|
|
private long awaitPingsSent;
|
|
private long awaitPongsReceived;
|
|
private final boolean client;
|
|
private final String connectionName;
|
|
private final Set<Integer> currentPushRequests;
|
|
private long degradedPingsSent;
|
|
private long degradedPongDeadlineNs;
|
|
private long degradedPongsReceived;
|
|
private long intervalPingsSent;
|
|
private long intervalPongsReceived;
|
|
private boolean isShutdown;
|
|
private int lastGoodStreamId;
|
|
private final Listener listener;
|
|
private int nextStreamId;
|
|
private final Settings okHttpSettings;
|
|
private Settings peerSettings;
|
|
private final PushObserver pushObserver;
|
|
private final TaskQueue pushQueue;
|
|
private long readBytesAcknowledged;
|
|
private long readBytesTotal;
|
|
private final ReaderRunnable readerRunnable;
|
|
private final TaskQueue settingsListenerQueue;
|
|
private final Socket socket;
|
|
private final Map<Integer, Http2Stream> streams;
|
|
private final TaskRunner taskRunner;
|
|
private long writeBytesMaximum;
|
|
private long writeBytesTotal;
|
|
private final Http2Writer writer;
|
|
private final TaskQueue writerQueue;
|
|
|
|
public final boolean pushedStream$okhttp(int i) {
|
|
return i != 0 && (i & 1) == 0;
|
|
}
|
|
|
|
public Http2Connection(Builder builder) {
|
|
C14957gcv.e(builder, "");
|
|
boolean client$okhttp = builder.getClient$okhttp();
|
|
this.client = client$okhttp;
|
|
this.listener = builder.getListener$okhttp();
|
|
this.streams = new LinkedHashMap();
|
|
String connectionName$okhttp = builder.getConnectionName$okhttp();
|
|
this.connectionName = connectionName$okhttp;
|
|
this.nextStreamId = builder.getClient$okhttp() ? 3 : 2;
|
|
TaskRunner taskRunner$okhttp = builder.getTaskRunner$okhttp();
|
|
this.taskRunner = taskRunner$okhttp;
|
|
TaskQueue newQueue = taskRunner$okhttp.newQueue();
|
|
this.writerQueue = newQueue;
|
|
this.pushQueue = taskRunner$okhttp.newQueue();
|
|
this.settingsListenerQueue = taskRunner$okhttp.newQueue();
|
|
this.pushObserver = builder.getPushObserver$okhttp();
|
|
Settings settings = new Settings();
|
|
if (builder.getClient$okhttp()) {
|
|
settings.set(7, OKHTTP_CLIENT_WINDOW_SIZE);
|
|
}
|
|
this.okHttpSettings = settings;
|
|
this.peerSettings = DEFAULT_SETTINGS;
|
|
this.writeBytesMaximum = r2.getInitialWindowSize();
|
|
this.socket = builder.getSocket$okhttp();
|
|
this.writer = new Http2Writer(builder.getSink$okhttp(), client$okhttp);
|
|
this.readerRunnable = new ReaderRunnable(this, new Http2Reader(builder.getSource$okhttp(), client$okhttp));
|
|
this.currentPushRequests = new LinkedHashSet();
|
|
if (builder.getPingIntervalMillis$okhttp() != 0) {
|
|
long nanos = TimeUnit.MILLISECONDS.toNanos(builder.getPingIntervalMillis$okhttp());
|
|
newQueue.schedule(new Task(C14957gcv.c(connectionName$okhttp, (Object) " ping"), this, nanos) { // from class: okhttp3.internal.http2.Http2Connection$special$$inlined$schedule$1
|
|
final String $name;
|
|
final long $pingIntervalNanos$inlined;
|
|
final Http2Connection this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, false, 2, null);
|
|
this.$name = r1;
|
|
this.this$0 = this;
|
|
this.$pingIntervalNanos$inlined = nanos;
|
|
}
|
|
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
long j;
|
|
long j2;
|
|
boolean z;
|
|
synchronized (this.this$0) {
|
|
long j3 = this.this$0.intervalPongsReceived;
|
|
j = this.this$0.intervalPingsSent;
|
|
if (j3 < j) {
|
|
z = true;
|
|
} else {
|
|
j2 = this.this$0.intervalPingsSent;
|
|
this.this$0.intervalPingsSent = j2 + 1;
|
|
z = false;
|
|
}
|
|
}
|
|
if (z) {
|
|
this.this$0.failConnection(null);
|
|
return -1L;
|
|
}
|
|
this.this$0.writePing(false, 1, 0);
|
|
return this.$pingIntervalNanos$inlined;
|
|
}
|
|
}, nanos);
|
|
}
|
|
}
|
|
|
|
public final int openStreamCount() {
|
|
int size;
|
|
synchronized (this) {
|
|
size = this.streams.size();
|
|
}
|
|
return size;
|
|
}
|
|
|
|
public final Http2Stream getStream(int i) {
|
|
Http2Stream http2Stream;
|
|
synchronized (this) {
|
|
http2Stream = this.streams.get(Integer.valueOf(i));
|
|
}
|
|
return http2Stream;
|
|
}
|
|
|
|
public final Http2Stream removeStream$okhttp(int i) {
|
|
Http2Stream remove;
|
|
synchronized (this) {
|
|
remove = this.streams.remove(Integer.valueOf(i));
|
|
notifyAll();
|
|
}
|
|
return remove;
|
|
}
|
|
|
|
public final void updateConnectionFlowControl$okhttp(long j) {
|
|
synchronized (this) {
|
|
long j2 = this.readBytesTotal + j;
|
|
this.readBytesTotal = j2;
|
|
long j3 = j2 - this.readBytesAcknowledged;
|
|
if (j3 >= this.okHttpSettings.getInitialWindowSize() / 2) {
|
|
writeWindowUpdateLater$okhttp(0, j3);
|
|
this.readBytesAcknowledged += j3;
|
|
}
|
|
}
|
|
}
|
|
|
|
public final Http2Stream pushStream(int i, List<Header> list, boolean z) throws IOException {
|
|
C14957gcv.e(list, "");
|
|
if (!(!this.client)) {
|
|
throw new IllegalStateException("Client cannot push requests.".toString());
|
|
}
|
|
return newStream(i, list, z);
|
|
}
|
|
|
|
public final Http2Stream newStream(List<Header> list, boolean z) throws IOException {
|
|
C14957gcv.e(list, "");
|
|
return newStream(0, list, z);
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:21:0x0055 A[Catch: all -> 0x0098, TryCatch #0 {, blocks: (B:6:0x0006, B:8:0x000f, B:9:0x0014, B:11:0x0018, B:13:0x0033, B:15:0x003f, B:19:0x004f, B:21:0x0055, B:22:0x0060, B:38:0x0092, B:39:0x0097), top: B:5:0x0006, outer: #1 }] */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct add '--show-bad-code' argument
|
|
*/
|
|
private final okhttp3.internal.http2.Http2Stream newStream(int r11, java.util.List<okhttp3.internal.http2.Header> r12, boolean r13) throws java.io.IOException {
|
|
/*
|
|
r10 = this;
|
|
r6 = r13 ^ 1
|
|
okhttp3.internal.http2.Http2Writer r7 = r10.writer
|
|
monitor-enter(r7)
|
|
monitor-enter(r10) // Catch: java.lang.Throwable -> L9b
|
|
int r0 = r10.getNextStreamId$okhttp() // Catch: java.lang.Throwable -> L98
|
|
r1 = 1073741823(0x3fffffff, float:1.9999999)
|
|
if (r0 <= r1) goto L14
|
|
okhttp3.internal.http2.ErrorCode r0 = okhttp3.internal.http2.ErrorCode.REFUSED_STREAM // Catch: java.lang.Throwable -> L98
|
|
r10.shutdown(r0) // Catch: java.lang.Throwable -> L98
|
|
L14:
|
|
boolean r0 = r10.isShutdown // Catch: java.lang.Throwable -> L98
|
|
if (r0 != 0) goto L92
|
|
int r8 = r10.getNextStreamId$okhttp() // Catch: java.lang.Throwable -> L98
|
|
int r0 = r10.getNextStreamId$okhttp() // Catch: java.lang.Throwable -> L98
|
|
int r0 = r0 + 2
|
|
r10.setNextStreamId$okhttp(r0) // Catch: java.lang.Throwable -> L98
|
|
okhttp3.internal.http2.Http2Stream r9 = new okhttp3.internal.http2.Http2Stream // Catch: java.lang.Throwable -> L98
|
|
r4 = 0
|
|
r5 = 0
|
|
r0 = r9
|
|
r1 = r8
|
|
r2 = r10
|
|
r3 = r6
|
|
r0.<init>(r1, r2, r3, r4, r5) // Catch: java.lang.Throwable -> L98
|
|
r0 = 1
|
|
if (r13 == 0) goto L4e
|
|
long r1 = r10.getWriteBytesTotal() // Catch: java.lang.Throwable -> L98
|
|
long r3 = r10.getWriteBytesMaximum() // Catch: java.lang.Throwable -> L98
|
|
int r13 = (r1 > r3 ? 1 : (r1 == r3 ? 0 : -1))
|
|
if (r13 >= 0) goto L4e
|
|
long r1 = r9.getWriteBytesTotal() // Catch: java.lang.Throwable -> L98
|
|
long r3 = r9.getWriteBytesMaximum() // Catch: java.lang.Throwable -> L98
|
|
int r13 = (r1 > r3 ? 1 : (r1 == r3 ? 0 : -1))
|
|
if (r13 < 0) goto L4c
|
|
goto L4e
|
|
L4c:
|
|
r13 = 0
|
|
goto L4f
|
|
L4e:
|
|
r13 = r0
|
|
L4f:
|
|
boolean r1 = r9.isOpen() // Catch: java.lang.Throwable -> L98
|
|
if (r1 == 0) goto L60
|
|
java.util.Map r1 = r10.getStreams$okhttp() // Catch: java.lang.Throwable -> L98
|
|
java.lang.Integer r2 = java.lang.Integer.valueOf(r8) // Catch: java.lang.Throwable -> L98
|
|
r1.put(r2, r9) // Catch: java.lang.Throwable -> L98
|
|
L60:
|
|
o.gag r1 = o.C14866gag.c // Catch: java.lang.Throwable -> L98
|
|
monitor-exit(r10)
|
|
if (r11 != 0) goto L6d
|
|
okhttp3.internal.http2.Http2Writer r11 = r10.getWriter() // Catch: java.lang.Throwable -> L9b
|
|
r11.headers(r6, r8, r12) // Catch: java.lang.Throwable -> L9b
|
|
goto L7b
|
|
L6d:
|
|
boolean r1 = r10.getClient$okhttp() // Catch: java.lang.Throwable -> L9b
|
|
r0 = r0 ^ r1
|
|
if (r0 == 0) goto L86
|
|
okhttp3.internal.http2.Http2Writer r0 = r10.getWriter() // Catch: java.lang.Throwable -> L9b
|
|
r0.pushPromise(r11, r8, r12) // Catch: java.lang.Throwable -> L9b
|
|
L7b:
|
|
o.gag r11 = o.C14866gag.c // Catch: java.lang.Throwable -> L9b
|
|
monitor-exit(r7)
|
|
if (r13 == 0) goto L85
|
|
okhttp3.internal.http2.Http2Writer r11 = r10.writer
|
|
r11.flush()
|
|
L85:
|
|
return r9
|
|
L86:
|
|
java.lang.IllegalArgumentException r11 = new java.lang.IllegalArgumentException // Catch: java.lang.Throwable -> L9b
|
|
java.lang.String r12 = "client streams shouldn't have associated stream IDs"
|
|
java.lang.String r12 = r12.toString() // Catch: java.lang.Throwable -> L9b
|
|
r11.<init>(r12) // Catch: java.lang.Throwable -> L9b
|
|
throw r11 // Catch: java.lang.Throwable -> L9b
|
|
L92:
|
|
okhttp3.internal.http2.ConnectionShutdownException r11 = new okhttp3.internal.http2.ConnectionShutdownException // Catch: java.lang.Throwable -> L98
|
|
r11.<init>() // Catch: java.lang.Throwable -> L98
|
|
throw r11 // Catch: java.lang.Throwable -> L98
|
|
L98:
|
|
r11 = move-exception
|
|
monitor-exit(r10) // Catch: java.lang.Throwable -> L9b
|
|
throw r11 // Catch: java.lang.Throwable -> L9b
|
|
L9b:
|
|
r11 = move-exception
|
|
monitor-exit(r7)
|
|
throw r11
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.http2.Http2Connection.newStream(int, java.util.List, boolean):okhttp3.internal.http2.Http2Stream");
|
|
}
|
|
|
|
public final void writeHeaders$okhttp(int i, boolean z, List<Header> list) throws IOException {
|
|
C14957gcv.e(list, "");
|
|
this.writer.headers(z, i, list);
|
|
}
|
|
|
|
public final void writeData(int i, boolean z, C15111ghZ c15111ghZ, long j) throws IOException {
|
|
int min;
|
|
long j2;
|
|
if (j == 0) {
|
|
this.writer.data(z, i, c15111ghZ, 0);
|
|
return;
|
|
}
|
|
while (j > 0) {
|
|
synchronized (this) {
|
|
while (getWriteBytesTotal() >= getWriteBytesMaximum()) {
|
|
try {
|
|
if (!getStreams$okhttp().containsKey(Integer.valueOf(i))) {
|
|
throw new IOException("stream closed");
|
|
}
|
|
wait();
|
|
} catch (InterruptedException unused) {
|
|
Thread.currentThread().interrupt();
|
|
throw new InterruptedIOException();
|
|
}
|
|
}
|
|
min = Math.min((int) Math.min(j, getWriteBytesMaximum() - getWriteBytesTotal()), getWriter().maxDataLength());
|
|
j2 = min;
|
|
this.writeBytesTotal = getWriteBytesTotal() + j2;
|
|
C14866gag c14866gag = C14866gag.c;
|
|
}
|
|
j -= j2;
|
|
this.writer.data(z && j == 0, i, c15111ghZ, min);
|
|
}
|
|
}
|
|
|
|
public final void writeSynResetLater$okhttp(int i, ErrorCode errorCode) {
|
|
C14957gcv.e(errorCode, "");
|
|
TaskQueue taskQueue = this.writerQueue;
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(this.connectionName);
|
|
sb.append('[');
|
|
sb.append(i);
|
|
sb.append("] writeSynReset");
|
|
taskQueue.schedule(new Task(sb.toString(), true, this, i, errorCode) { // from class: okhttp3.internal.http2.Http2Connection$writeSynResetLater$$inlined$execute$default$1
|
|
final boolean $cancelable;
|
|
final ErrorCode $errorCode$inlined;
|
|
final String $name;
|
|
final int $streamId$inlined;
|
|
final Http2Connection this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, r2);
|
|
this.$name = r1;
|
|
this.$cancelable = r2;
|
|
this.this$0 = this;
|
|
this.$streamId$inlined = i;
|
|
this.$errorCode$inlined = errorCode;
|
|
}
|
|
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
try {
|
|
this.this$0.writeSynReset$okhttp(this.$streamId$inlined, this.$errorCode$inlined);
|
|
return -1L;
|
|
} catch (IOException e) {
|
|
this.this$0.failConnection(e);
|
|
return -1L;
|
|
}
|
|
}
|
|
}, 0L);
|
|
}
|
|
|
|
public final void writeSynReset$okhttp(int i, ErrorCode errorCode) throws IOException {
|
|
C14957gcv.e(errorCode, "");
|
|
this.writer.rstStream(i, errorCode);
|
|
}
|
|
|
|
public final void writeWindowUpdateLater$okhttp(int i, long j) {
|
|
TaskQueue taskQueue = this.writerQueue;
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(this.connectionName);
|
|
sb.append('[');
|
|
sb.append(i);
|
|
sb.append("] windowUpdate");
|
|
taskQueue.schedule(new Task(sb.toString(), true, this, i, j) { // from class: okhttp3.internal.http2.Http2Connection$writeWindowUpdateLater$$inlined$execute$default$1
|
|
final boolean $cancelable;
|
|
final String $name;
|
|
final int $streamId$inlined;
|
|
final long $unacknowledgedBytesRead$inlined;
|
|
final Http2Connection this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, r2);
|
|
this.$name = r1;
|
|
this.$cancelable = r2;
|
|
this.this$0 = this;
|
|
this.$streamId$inlined = i;
|
|
this.$unacknowledgedBytesRead$inlined = j;
|
|
}
|
|
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
try {
|
|
this.this$0.getWriter().windowUpdate(this.$streamId$inlined, this.$unacknowledgedBytesRead$inlined);
|
|
return -1L;
|
|
} catch (IOException e) {
|
|
this.this$0.failConnection(e);
|
|
return -1L;
|
|
}
|
|
}
|
|
}, 0L);
|
|
}
|
|
|
|
public final void writePing(boolean z, int i, int i2) {
|
|
try {
|
|
this.writer.ping(z, i, i2);
|
|
} catch (IOException e) {
|
|
failConnection(e);
|
|
}
|
|
}
|
|
|
|
public final void writePingAndAwaitPong() throws InterruptedException {
|
|
writePing();
|
|
awaitPong();
|
|
}
|
|
|
|
public final void writePing() throws InterruptedException {
|
|
synchronized (this) {
|
|
this.awaitPingsSent++;
|
|
}
|
|
writePing(false, 3, 1330343787);
|
|
}
|
|
|
|
public final void flush() throws IOException {
|
|
this.writer.flush();
|
|
}
|
|
|
|
public final void shutdown(ErrorCode errorCode) throws IOException {
|
|
C14957gcv.e(errorCode, "");
|
|
synchronized (this.writer) {
|
|
C14930gcM.IeS ieS = new C14930gcM.IeS();
|
|
synchronized (this) {
|
|
if (this.isShutdown) {
|
|
return;
|
|
}
|
|
this.isShutdown = true;
|
|
ieS.b = getLastGoodStreamId$okhttp();
|
|
C14866gag c14866gag = C14866gag.c;
|
|
getWriter().goAway(ieS.b, errorCode, Util.EMPTY_BYTE_ARRAY);
|
|
C14866gag c14866gag2 = C14866gag.c;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // java.io.Closeable, java.lang.AutoCloseable
|
|
public final void close() {
|
|
close$okhttp(ErrorCode.NO_ERROR, ErrorCode.CANCEL, null);
|
|
}
|
|
|
|
public final void failConnection(IOException iOException) {
|
|
ErrorCode errorCode = ErrorCode.PROTOCOL_ERROR;
|
|
close$okhttp(errorCode, errorCode, iOException);
|
|
}
|
|
|
|
public static /* synthetic */ void start$default(Http2Connection http2Connection, boolean z, TaskRunner taskRunner, int i, Object obj) throws IOException {
|
|
if ((i & 1) != 0) {
|
|
z = true;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
taskRunner = TaskRunner.INSTANCE;
|
|
}
|
|
http2Connection.start(z, taskRunner);
|
|
}
|
|
|
|
public final void start(boolean z, TaskRunner taskRunner) throws IOException {
|
|
C14957gcv.e(taskRunner, "");
|
|
if (z) {
|
|
this.writer.connectionPreface();
|
|
this.writer.settings(this.okHttpSettings);
|
|
if (this.okHttpSettings.getInitialWindowSize() != 65535) {
|
|
this.writer.windowUpdate(0, r5 - 65535);
|
|
}
|
|
}
|
|
taskRunner.newQueue().schedule(new TaskQueue$execute$1(this.connectionName, true, this.readerRunnable), 0L);
|
|
}
|
|
|
|
public final void setSettings(Settings settings) throws IOException {
|
|
C14957gcv.e(settings, "");
|
|
synchronized (this.writer) {
|
|
synchronized (this) {
|
|
if (this.isShutdown) {
|
|
throw new ConnectionShutdownException();
|
|
}
|
|
getOkHttpSettings().merge(settings);
|
|
C14866gag c14866gag = C14866gag.c;
|
|
}
|
|
getWriter().settings(settings);
|
|
C14866gag c14866gag2 = C14866gag.c;
|
|
}
|
|
}
|
|
|
|
public final boolean isHealthy(long j) {
|
|
synchronized (this) {
|
|
if (this.isShutdown) {
|
|
return false;
|
|
}
|
|
if (this.degradedPongsReceived < this.degradedPingsSent) {
|
|
if (j >= this.degradedPongDeadlineNs) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
public final void sendDegradedPingLater$okhttp() {
|
|
synchronized (this) {
|
|
long j = this.degradedPongsReceived;
|
|
long j2 = this.degradedPingsSent;
|
|
if (j < j2) {
|
|
return;
|
|
}
|
|
this.degradedPingsSent = j2 + 1;
|
|
this.degradedPongDeadlineNs = System.nanoTime() + 1000000000;
|
|
C14866gag c14866gag = C14866gag.c;
|
|
this.writerQueue.schedule(new Task(C14957gcv.c(this.connectionName, (Object) " ping"), true, this) { // from class: okhttp3.internal.http2.Http2Connection$sendDegradedPingLater$$inlined$execute$default$1
|
|
final boolean $cancelable;
|
|
final String $name;
|
|
final Http2Connection this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, r2);
|
|
this.$name = r1;
|
|
this.$cancelable = r2;
|
|
this.this$0 = this;
|
|
}
|
|
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
this.this$0.writePing(false, 2, 0);
|
|
return -1L;
|
|
}
|
|
}, 0L);
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static final class Builder {
|
|
private boolean client;
|
|
public String connectionName;
|
|
private Listener listener;
|
|
private int pingIntervalMillis;
|
|
private PushObserver pushObserver;
|
|
public InterfaceC15148gic sink;
|
|
public Socket socket;
|
|
public InterfaceC15149gid source;
|
|
private final TaskRunner taskRunner;
|
|
|
|
public Builder(boolean z, TaskRunner taskRunner) {
|
|
C14957gcv.e(taskRunner, "");
|
|
this.client = z;
|
|
this.taskRunner = taskRunner;
|
|
this.listener = Listener.REFUSE_INCOMING_STREAMS;
|
|
this.pushObserver = PushObserver.CANCEL;
|
|
}
|
|
|
|
public final Socket getSocket$okhttp() {
|
|
Socket socket = this.socket;
|
|
if (socket != null) {
|
|
return socket;
|
|
}
|
|
C14957gcv.a("");
|
|
return null;
|
|
}
|
|
|
|
public final String getConnectionName$okhttp() {
|
|
String str = this.connectionName;
|
|
if (str != null) {
|
|
return str;
|
|
}
|
|
C14957gcv.a("");
|
|
return null;
|
|
}
|
|
|
|
public final InterfaceC15149gid getSource$okhttp() {
|
|
InterfaceC15149gid interfaceC15149gid = this.source;
|
|
if (interfaceC15149gid != null) {
|
|
return interfaceC15149gid;
|
|
}
|
|
C14957gcv.a("");
|
|
return null;
|
|
}
|
|
|
|
public final InterfaceC15148gic getSink$okhttp() {
|
|
InterfaceC15148gic interfaceC15148gic = this.sink;
|
|
if (interfaceC15148gic != null) {
|
|
return interfaceC15148gic;
|
|
}
|
|
C14957gcv.a("");
|
|
return null;
|
|
}
|
|
|
|
public static /* synthetic */ Builder socket$default(Builder builder, Socket socket, String str, InterfaceC15149gid interfaceC15149gid, InterfaceC15148gic interfaceC15148gic, int i, Object obj) throws IOException {
|
|
if ((i & 2) != 0) {
|
|
str = Util.peerName(socket);
|
|
}
|
|
if ((i & 4) != 0) {
|
|
interfaceC15149gid = C15160gio.c(C15160gio.e(socket));
|
|
}
|
|
if ((i & 8) != 0) {
|
|
interfaceC15148gic = C15160gio.c(C15160gio.c(socket));
|
|
}
|
|
return builder.socket(socket, str, interfaceC15149gid, interfaceC15148gic);
|
|
}
|
|
|
|
public final Builder socket(Socket socket, String str, InterfaceC15149gid interfaceC15149gid, InterfaceC15148gic interfaceC15148gic) throws IOException {
|
|
String c;
|
|
C14957gcv.e(socket, "");
|
|
C14957gcv.e(str, "");
|
|
C14957gcv.e(interfaceC15149gid, "");
|
|
C14957gcv.e(interfaceC15148gic, "");
|
|
setSocket$okhttp(socket);
|
|
if (getClient$okhttp()) {
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(Util.okHttpName);
|
|
sb.append(' ');
|
|
sb.append(str);
|
|
c = sb.toString();
|
|
} else {
|
|
c = C14957gcv.c("MockWebServer ", (Object) str);
|
|
}
|
|
setConnectionName$okhttp(c);
|
|
setSource$okhttp(interfaceC15149gid);
|
|
setSink$okhttp(interfaceC15148gic);
|
|
return this;
|
|
}
|
|
|
|
public final Builder listener(Listener listener) {
|
|
C14957gcv.e(listener, "");
|
|
setListener$okhttp(listener);
|
|
return this;
|
|
}
|
|
|
|
public final Builder pushObserver(PushObserver pushObserver) {
|
|
C14957gcv.e(pushObserver, "");
|
|
setPushObserver$okhttp(pushObserver);
|
|
return this;
|
|
}
|
|
|
|
public final Builder pingIntervalMillis(int i) {
|
|
setPingIntervalMillis$okhttp(i);
|
|
return this;
|
|
}
|
|
|
|
public final Http2Connection build() {
|
|
return new Http2Connection(this);
|
|
}
|
|
|
|
public final Builder socket(Socket socket, String str, InterfaceC15149gid interfaceC15149gid) throws IOException {
|
|
C14957gcv.e(socket, "");
|
|
C14957gcv.e(str, "");
|
|
C14957gcv.e(interfaceC15149gid, "");
|
|
return socket$default(this, socket, str, interfaceC15149gid, null, 8, null);
|
|
}
|
|
|
|
public final Builder socket(Socket socket, String str) throws IOException {
|
|
C14957gcv.e(socket, "");
|
|
C14957gcv.e(str, "");
|
|
return socket$default(this, socket, str, null, null, 12, null);
|
|
}
|
|
|
|
public final Builder socket(Socket socket) throws IOException {
|
|
C14957gcv.e(socket, "");
|
|
return socket$default(this, socket, null, null, null, 14, null);
|
|
}
|
|
|
|
public final void setSource$okhttp(InterfaceC15149gid interfaceC15149gid) {
|
|
C14957gcv.e(interfaceC15149gid, "");
|
|
this.source = interfaceC15149gid;
|
|
}
|
|
|
|
public final void setSocket$okhttp(Socket socket) {
|
|
C14957gcv.e(socket, "");
|
|
this.socket = socket;
|
|
}
|
|
|
|
public final void setSink$okhttp(InterfaceC15148gic interfaceC15148gic) {
|
|
C14957gcv.e(interfaceC15148gic, "");
|
|
this.sink = interfaceC15148gic;
|
|
}
|
|
|
|
public final void setPushObserver$okhttp(PushObserver pushObserver) {
|
|
C14957gcv.e(pushObserver, "");
|
|
this.pushObserver = pushObserver;
|
|
}
|
|
|
|
public final void setPingIntervalMillis$okhttp(int i) {
|
|
this.pingIntervalMillis = i;
|
|
}
|
|
|
|
public final void setListener$okhttp(Listener listener) {
|
|
C14957gcv.e(listener, "");
|
|
this.listener = listener;
|
|
}
|
|
|
|
public final void setConnectionName$okhttp(String str) {
|
|
C14957gcv.e(str, "");
|
|
this.connectionName = str;
|
|
}
|
|
|
|
public final void setClient$okhttp(boolean z) {
|
|
this.client = z;
|
|
}
|
|
|
|
public final TaskRunner getTaskRunner$okhttp() {
|
|
return this.taskRunner;
|
|
}
|
|
|
|
public final PushObserver getPushObserver$okhttp() {
|
|
return this.pushObserver;
|
|
}
|
|
|
|
public final int getPingIntervalMillis$okhttp() {
|
|
return this.pingIntervalMillis;
|
|
}
|
|
|
|
public final Listener getListener$okhttp() {
|
|
return this.listener;
|
|
}
|
|
|
|
public final boolean getClient$okhttp() {
|
|
return this.client;
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class ReaderRunnable implements Http2Reader.Handler, InterfaceC14890gbN<C14866gag> {
|
|
private final Http2Reader reader;
|
|
final Http2Connection this$0;
|
|
|
|
@Override // okhttp3.internal.http2.Http2Reader.Handler
|
|
public final void ackSettings() {
|
|
}
|
|
|
|
@Override // okhttp3.internal.http2.Http2Reader.Handler
|
|
public final void priority(int i, int i2, int i3, boolean z) {
|
|
}
|
|
|
|
public ReaderRunnable(Http2Connection http2Connection, Http2Reader http2Reader) {
|
|
C14957gcv.e(http2Connection, "");
|
|
C14957gcv.e(http2Reader, "");
|
|
this.this$0 = http2Connection;
|
|
this.reader = http2Reader;
|
|
}
|
|
|
|
@Override // o.InterfaceC14890gbN
|
|
public final /* bridge */ /* synthetic */ C14866gag invoke() {
|
|
invoke2();
|
|
return C14866gag.c;
|
|
}
|
|
|
|
/* renamed from: invoke */
|
|
public final void invoke2() {
|
|
ErrorCode errorCode;
|
|
ErrorCode errorCode2 = ErrorCode.INTERNAL_ERROR;
|
|
ErrorCode errorCode3 = ErrorCode.INTERNAL_ERROR;
|
|
IOException e = null;
|
|
try {
|
|
try {
|
|
this.reader.readConnectionPreface(this);
|
|
do {
|
|
} while (this.reader.nextFrame(false, this));
|
|
errorCode2 = ErrorCode.NO_ERROR;
|
|
errorCode = ErrorCode.CANCEL;
|
|
} catch (IOException e2) {
|
|
e = e2;
|
|
errorCode2 = ErrorCode.PROTOCOL_ERROR;
|
|
errorCode = ErrorCode.PROTOCOL_ERROR;
|
|
}
|
|
this.this$0.close$okhttp(errorCode2, errorCode, e);
|
|
Util.closeQuietly(this.reader);
|
|
} catch (Throwable th) {
|
|
this.this$0.close$okhttp(errorCode2, errorCode3, e);
|
|
Util.closeQuietly(this.reader);
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
@Override // okhttp3.internal.http2.Http2Reader.Handler
|
|
public final void data(boolean z, int i, InterfaceC15149gid interfaceC15149gid, int i2) throws IOException {
|
|
C14957gcv.e(interfaceC15149gid, "");
|
|
if (this.this$0.pushedStream$okhttp(i)) {
|
|
this.this$0.pushDataLater$okhttp(i, interfaceC15149gid, i2, z);
|
|
return;
|
|
}
|
|
Http2Stream stream = this.this$0.getStream(i);
|
|
if (stream == null) {
|
|
this.this$0.writeSynResetLater$okhttp(i, ErrorCode.PROTOCOL_ERROR);
|
|
long j = i2;
|
|
this.this$0.updateConnectionFlowControl$okhttp(j);
|
|
interfaceC15149gid.j(j);
|
|
return;
|
|
}
|
|
stream.receiveData(interfaceC15149gid, i2);
|
|
if (z) {
|
|
stream.receiveHeaders(Util.EMPTY_HEADERS, true);
|
|
}
|
|
}
|
|
|
|
@Override // okhttp3.internal.http2.Http2Reader.Handler
|
|
public final void headers(boolean z, int i, int i2, List<Header> list) {
|
|
C14957gcv.e(list, "");
|
|
if (this.this$0.pushedStream$okhttp(i)) {
|
|
this.this$0.pushHeadersLater$okhttp(i, list, z);
|
|
return;
|
|
}
|
|
Http2Connection http2Connection = this.this$0;
|
|
synchronized (http2Connection) {
|
|
Http2Stream stream = http2Connection.getStream(i);
|
|
if (stream == null) {
|
|
if (http2Connection.isShutdown) {
|
|
return;
|
|
}
|
|
if (i <= http2Connection.getLastGoodStreamId$okhttp()) {
|
|
return;
|
|
}
|
|
if (i % 2 == http2Connection.getNextStreamId$okhttp() % 2) {
|
|
return;
|
|
}
|
|
Http2Stream http2Stream = new Http2Stream(i, http2Connection, false, z, Util.toHeaders(list));
|
|
http2Connection.setLastGoodStreamId$okhttp(i);
|
|
http2Connection.getStreams$okhttp().put(Integer.valueOf(i), http2Stream);
|
|
TaskQueue newQueue = http2Connection.taskRunner.newQueue();
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(http2Connection.getConnectionName$okhttp());
|
|
sb.append('[');
|
|
sb.append(i);
|
|
sb.append("] onStream");
|
|
newQueue.schedule(new Task(sb.toString(), true, http2Connection, http2Stream) { // from class: okhttp3.internal.http2.Http2Connection$ReaderRunnable$headers$lambda-2$$inlined$execute$default$1
|
|
final boolean $cancelable;
|
|
final String $name;
|
|
final Http2Stream $newStream$inlined;
|
|
final Http2Connection this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, r2);
|
|
this.$name = r1;
|
|
this.$cancelable = r2;
|
|
this.this$0 = http2Connection;
|
|
this.$newStream$inlined = http2Stream;
|
|
}
|
|
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
try {
|
|
this.this$0.getListener$okhttp().onStream(this.$newStream$inlined);
|
|
return -1L;
|
|
} catch (IOException e) {
|
|
Platform.Companion.get().log(C14957gcv.c("Http2Connection.Listener failure for ", (Object) this.this$0.getConnectionName$okhttp()), 4, e);
|
|
try {
|
|
this.$newStream$inlined.close(ErrorCode.PROTOCOL_ERROR, e);
|
|
return -1L;
|
|
} catch (IOException unused) {
|
|
return -1L;
|
|
}
|
|
}
|
|
}
|
|
}, 0L);
|
|
return;
|
|
}
|
|
C14866gag c14866gag = C14866gag.c;
|
|
stream.receiveHeaders(Util.toHeaders(list), z);
|
|
}
|
|
}
|
|
|
|
@Override // okhttp3.internal.http2.Http2Reader.Handler
|
|
public final void rstStream(int i, ErrorCode errorCode) {
|
|
C14957gcv.e(errorCode, "");
|
|
if (this.this$0.pushedStream$okhttp(i)) {
|
|
this.this$0.pushResetLater$okhttp(i, errorCode);
|
|
return;
|
|
}
|
|
Http2Stream removeStream$okhttp = this.this$0.removeStream$okhttp(i);
|
|
if (removeStream$okhttp != null) {
|
|
removeStream$okhttp.receiveRstStream(errorCode);
|
|
}
|
|
}
|
|
|
|
@Override // okhttp3.internal.http2.Http2Reader.Handler
|
|
public final void settings(boolean z, Settings settings) {
|
|
C14957gcv.e(settings, "");
|
|
this.this$0.writerQueue.schedule(new Task(C14957gcv.c(this.this$0.getConnectionName$okhttp(), (Object) " applyAndAckSettings"), true, this, z, settings) { // from class: okhttp3.internal.http2.Http2Connection$ReaderRunnable$settings$$inlined$execute$default$1
|
|
final boolean $cancelable;
|
|
final boolean $clearPrevious$inlined;
|
|
final String $name;
|
|
final Settings $settings$inlined;
|
|
final Http2Connection.ReaderRunnable this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, r2);
|
|
this.$name = r1;
|
|
this.$cancelable = r2;
|
|
this.this$0 = this;
|
|
this.$clearPrevious$inlined = z;
|
|
this.$settings$inlined = settings;
|
|
}
|
|
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
this.this$0.applyAndAckSettings(this.$clearPrevious$inlined, this.$settings$inlined);
|
|
return -1L;
|
|
}
|
|
}, 0L);
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public final void applyAndAckSettings(boolean z, Settings settings) {
|
|
long initialWindowSize;
|
|
int i;
|
|
Http2Stream[] http2StreamArr;
|
|
C14957gcv.e(settings, "");
|
|
C14930gcM.RVV rvv = new C14930gcM.RVV();
|
|
Http2Writer writer = this.this$0.getWriter();
|
|
Http2Connection http2Connection = this.this$0;
|
|
synchronized (writer) {
|
|
synchronized (http2Connection) {
|
|
Settings peerSettings = http2Connection.getPeerSettings();
|
|
T t = settings;
|
|
if (!z) {
|
|
Settings settings2 = new Settings();
|
|
settings2.merge(peerSettings);
|
|
settings2.merge(settings);
|
|
t = settings2;
|
|
}
|
|
rvv.d = t;
|
|
initialWindowSize = ((Settings) rvv.d).getInitialWindowSize() - peerSettings.getInitialWindowSize();
|
|
i = 0;
|
|
if (initialWindowSize != 0 && !http2Connection.getStreams$okhttp().isEmpty()) {
|
|
Object[] array = http2Connection.getStreams$okhttp().values().toArray(new Http2Stream[0]);
|
|
if (array == null) {
|
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
|
|
}
|
|
http2StreamArr = (Http2Stream[]) array;
|
|
http2Connection.setPeerSettings((Settings) rvv.d);
|
|
http2Connection.settingsListenerQueue.schedule(new Task(C14957gcv.c(http2Connection.getConnectionName$okhttp(), (Object) " onSettings"), true, http2Connection, rvv) { // from class: okhttp3.internal.http2.Http2Connection$ReaderRunnable$applyAndAckSettings$lambda-7$lambda-6$$inlined$execute$default$1
|
|
final boolean $cancelable;
|
|
final String $name;
|
|
final C14930gcM.RVV $newPeerSettings$inlined;
|
|
final Http2Connection this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, r2);
|
|
this.$name = r1;
|
|
this.$cancelable = r2;
|
|
this.this$0 = http2Connection;
|
|
this.$newPeerSettings$inlined = rvv;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
this.this$0.getListener$okhttp().onSettings(this.this$0, (Settings) this.$newPeerSettings$inlined.d);
|
|
return -1L;
|
|
}
|
|
}, 0L);
|
|
C14866gag c14866gag = C14866gag.c;
|
|
}
|
|
http2StreamArr = null;
|
|
http2Connection.setPeerSettings((Settings) rvv.d);
|
|
http2Connection.settingsListenerQueue.schedule(new Task(C14957gcv.c(http2Connection.getConnectionName$okhttp(), (Object) " onSettings"), true, http2Connection, rvv) { // from class: okhttp3.internal.http2.Http2Connection$ReaderRunnable$applyAndAckSettings$lambda-7$lambda-6$$inlined$execute$default$1
|
|
final boolean $cancelable;
|
|
final String $name;
|
|
final C14930gcM.RVV $newPeerSettings$inlined;
|
|
final Http2Connection this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, r2);
|
|
this.$name = r1;
|
|
this.$cancelable = r2;
|
|
this.this$0 = http2Connection;
|
|
this.$newPeerSettings$inlined = rvv;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
this.this$0.getListener$okhttp().onSettings(this.this$0, (Settings) this.$newPeerSettings$inlined.d);
|
|
return -1L;
|
|
}
|
|
}, 0L);
|
|
C14866gag c14866gag2 = C14866gag.c;
|
|
}
|
|
try {
|
|
http2Connection.getWriter().applyAndAckSettings((Settings) rvv.d);
|
|
} catch (IOException e) {
|
|
http2Connection.failConnection(e);
|
|
}
|
|
C14866gag c14866gag3 = C14866gag.c;
|
|
}
|
|
if (http2StreamArr != null) {
|
|
int length = http2StreamArr.length;
|
|
while (i < length) {
|
|
Http2Stream http2Stream = http2StreamArr[i];
|
|
i++;
|
|
synchronized (http2Stream) {
|
|
http2Stream.addBytesToWriteWindow(initialWindowSize);
|
|
C14866gag c14866gag4 = C14866gag.c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // okhttp3.internal.http2.Http2Reader.Handler
|
|
public final void ping(boolean z, int i, int i2) {
|
|
if (z) {
|
|
Http2Connection http2Connection = this.this$0;
|
|
synchronized (http2Connection) {
|
|
if (i == 1) {
|
|
http2Connection.intervalPongsReceived++;
|
|
} else if (i != 2) {
|
|
if (i == 3) {
|
|
http2Connection.awaitPongsReceived++;
|
|
http2Connection.notifyAll();
|
|
}
|
|
C14866gag c14866gag = C14866gag.c;
|
|
} else {
|
|
http2Connection.degradedPongsReceived++;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
this.this$0.writerQueue.schedule(new Task(C14957gcv.c(this.this$0.getConnectionName$okhttp(), (Object) " ping"), true, this.this$0, i, i2) { // from class: okhttp3.internal.http2.Http2Connection$ReaderRunnable$ping$$inlined$execute$default$1
|
|
final boolean $cancelable;
|
|
final String $name;
|
|
final int $payload1$inlined;
|
|
final int $payload2$inlined;
|
|
final Http2Connection this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, r2);
|
|
this.$name = r1;
|
|
this.$cancelable = r2;
|
|
this.this$0 = r3;
|
|
this.$payload1$inlined = i;
|
|
this.$payload2$inlined = i2;
|
|
}
|
|
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
this.this$0.writePing(true, this.$payload1$inlined, this.$payload2$inlined);
|
|
return -1L;
|
|
}
|
|
}, 0L);
|
|
}
|
|
|
|
@Override // okhttp3.internal.http2.Http2Reader.Handler
|
|
public final void windowUpdate(int i, long j) {
|
|
if (i == 0) {
|
|
Http2Connection http2Connection = this.this$0;
|
|
synchronized (http2Connection) {
|
|
http2Connection.writeBytesMaximum = http2Connection.getWriteBytesMaximum() + j;
|
|
http2Connection.notifyAll();
|
|
C14866gag c14866gag = C14866gag.c;
|
|
}
|
|
return;
|
|
}
|
|
Http2Stream stream = this.this$0.getStream(i);
|
|
if (stream != null) {
|
|
synchronized (stream) {
|
|
stream.addBytesToWriteWindow(j);
|
|
C14866gag c14866gag2 = C14866gag.c;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // okhttp3.internal.http2.Http2Reader.Handler
|
|
public final void pushPromise(int i, int i2, List<Header> list) {
|
|
C14957gcv.e(list, "");
|
|
this.this$0.pushRequestLater$okhttp(i2, list);
|
|
}
|
|
|
|
@Override // okhttp3.internal.http2.Http2Reader.Handler
|
|
public final void goAway(int i, ErrorCode errorCode, C15155gij c15155gij) {
|
|
int i2;
|
|
Object[] array;
|
|
C14957gcv.e(errorCode, "");
|
|
C14957gcv.e(c15155gij, "");
|
|
c15155gij.a();
|
|
Http2Connection http2Connection = this.this$0;
|
|
synchronized (http2Connection) {
|
|
i2 = 0;
|
|
array = http2Connection.getStreams$okhttp().values().toArray(new Http2Stream[0]);
|
|
if (array != null) {
|
|
http2Connection.isShutdown = true;
|
|
C14866gag c14866gag = C14866gag.c;
|
|
} else {
|
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
|
|
}
|
|
}
|
|
Http2Stream[] http2StreamArr = (Http2Stream[]) array;
|
|
int length = http2StreamArr.length;
|
|
while (i2 < length) {
|
|
Http2Stream http2Stream = http2StreamArr[i2];
|
|
i2++;
|
|
if (http2Stream.getId() > i && http2Stream.isLocallyInitiated()) {
|
|
http2Stream.receiveRstStream(ErrorCode.REFUSED_STREAM);
|
|
this.this$0.removeStream$okhttp(http2Stream.getId());
|
|
}
|
|
}
|
|
}
|
|
|
|
public final Http2Reader getReader$okhttp() {
|
|
return this.reader;
|
|
}
|
|
|
|
@Override // okhttp3.internal.http2.Http2Reader.Handler
|
|
public final void alternateService(int i, String str, C15155gij c15155gij, String str2, int i2, long j) {
|
|
C14957gcv.e(str, "");
|
|
C14957gcv.e(c15155gij, "");
|
|
C14957gcv.e(str2, "");
|
|
}
|
|
}
|
|
|
|
public final void pushRequestLater$okhttp(int i, List<Header> list) {
|
|
C14957gcv.e(list, "");
|
|
synchronized (this) {
|
|
if (this.currentPushRequests.contains(Integer.valueOf(i))) {
|
|
writeSynResetLater$okhttp(i, ErrorCode.PROTOCOL_ERROR);
|
|
return;
|
|
}
|
|
this.currentPushRequests.add(Integer.valueOf(i));
|
|
TaskQueue taskQueue = this.pushQueue;
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(this.connectionName);
|
|
sb.append('[');
|
|
sb.append(i);
|
|
sb.append("] onRequest");
|
|
taskQueue.schedule(new Task(sb.toString(), true, this, i, list) { // from class: okhttp3.internal.http2.Http2Connection$pushRequestLater$$inlined$execute$default$1
|
|
final boolean $cancelable;
|
|
final String $name;
|
|
final List $requestHeaders$inlined;
|
|
final int $streamId$inlined;
|
|
final Http2Connection this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, r2);
|
|
this.$name = r1;
|
|
this.$cancelable = r2;
|
|
this.this$0 = this;
|
|
this.$streamId$inlined = i;
|
|
this.$requestHeaders$inlined = list;
|
|
}
|
|
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
PushObserver pushObserver;
|
|
Set set;
|
|
pushObserver = this.this$0.pushObserver;
|
|
if (!pushObserver.onRequest(this.$streamId$inlined, this.$requestHeaders$inlined)) {
|
|
return -1L;
|
|
}
|
|
try {
|
|
this.this$0.getWriter().rstStream(this.$streamId$inlined, ErrorCode.CANCEL);
|
|
synchronized (this.this$0) {
|
|
set = this.this$0.currentPushRequests;
|
|
set.remove(Integer.valueOf(this.$streamId$inlined));
|
|
}
|
|
return -1L;
|
|
} catch (IOException unused) {
|
|
return -1L;
|
|
}
|
|
}
|
|
}, 0L);
|
|
}
|
|
}
|
|
|
|
public final void pushHeadersLater$okhttp(int i, List<Header> list, boolean z) {
|
|
C14957gcv.e(list, "");
|
|
TaskQueue taskQueue = this.pushQueue;
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(this.connectionName);
|
|
sb.append('[');
|
|
sb.append(i);
|
|
sb.append("] onHeaders");
|
|
taskQueue.schedule(new Task(sb.toString(), true, this, i, list, z) { // from class: okhttp3.internal.http2.Http2Connection$pushHeadersLater$$inlined$execute$default$1
|
|
final boolean $cancelable;
|
|
final boolean $inFinished$inlined;
|
|
final String $name;
|
|
final List $requestHeaders$inlined;
|
|
final int $streamId$inlined;
|
|
final Http2Connection this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, r2);
|
|
this.$name = r1;
|
|
this.$cancelable = r2;
|
|
this.this$0 = this;
|
|
this.$streamId$inlined = i;
|
|
this.$requestHeaders$inlined = list;
|
|
this.$inFinished$inlined = z;
|
|
}
|
|
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
PushObserver pushObserver;
|
|
Set set;
|
|
pushObserver = this.this$0.pushObserver;
|
|
boolean onHeaders = pushObserver.onHeaders(this.$streamId$inlined, this.$requestHeaders$inlined, this.$inFinished$inlined);
|
|
if (onHeaders) {
|
|
try {
|
|
this.this$0.getWriter().rstStream(this.$streamId$inlined, ErrorCode.CANCEL);
|
|
} catch (IOException unused) {
|
|
return -1L;
|
|
}
|
|
}
|
|
if (!onHeaders && !this.$inFinished$inlined) {
|
|
return -1L;
|
|
}
|
|
synchronized (this.this$0) {
|
|
set = this.this$0.currentPushRequests;
|
|
set.remove(Integer.valueOf(this.$streamId$inlined));
|
|
}
|
|
return -1L;
|
|
}
|
|
}, 0L);
|
|
}
|
|
|
|
public final void pushDataLater$okhttp(int i, InterfaceC15149gid interfaceC15149gid, int i2, boolean z) throws IOException {
|
|
C14957gcv.e(interfaceC15149gid, "");
|
|
C15111ghZ c15111ghZ = new C15111ghZ();
|
|
long j = i2;
|
|
interfaceC15149gid.g(j);
|
|
interfaceC15149gid.read(c15111ghZ, j);
|
|
TaskQueue taskQueue = this.pushQueue;
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(this.connectionName);
|
|
sb.append('[');
|
|
sb.append(i);
|
|
sb.append("] onData");
|
|
taskQueue.schedule(new Task(sb.toString(), true, this, i, c15111ghZ, i2, z) { // from class: okhttp3.internal.http2.Http2Connection$pushDataLater$$inlined$execute$default$1
|
|
final C15111ghZ $buffer$inlined;
|
|
final int $byteCount$inlined;
|
|
final boolean $cancelable;
|
|
final boolean $inFinished$inlined;
|
|
final String $name;
|
|
final int $streamId$inlined;
|
|
final Http2Connection this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, r2);
|
|
this.$name = r1;
|
|
this.$cancelable = r2;
|
|
this.this$0 = this;
|
|
this.$streamId$inlined = i;
|
|
this.$buffer$inlined = c15111ghZ;
|
|
this.$byteCount$inlined = i2;
|
|
this.$inFinished$inlined = z;
|
|
}
|
|
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
PushObserver pushObserver;
|
|
Set set;
|
|
try {
|
|
pushObserver = this.this$0.pushObserver;
|
|
boolean onData = pushObserver.onData(this.$streamId$inlined, this.$buffer$inlined, this.$byteCount$inlined, this.$inFinished$inlined);
|
|
if (onData) {
|
|
this.this$0.getWriter().rstStream(this.$streamId$inlined, ErrorCode.CANCEL);
|
|
}
|
|
if (!onData && !this.$inFinished$inlined) {
|
|
return -1L;
|
|
}
|
|
synchronized (this.this$0) {
|
|
set = this.this$0.currentPushRequests;
|
|
set.remove(Integer.valueOf(this.$streamId$inlined));
|
|
}
|
|
return -1L;
|
|
} catch (IOException unused) {
|
|
return -1L;
|
|
}
|
|
}
|
|
}, 0L);
|
|
}
|
|
|
|
public final void pushResetLater$okhttp(int i, ErrorCode errorCode) {
|
|
C14957gcv.e(errorCode, "");
|
|
TaskQueue taskQueue = this.pushQueue;
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(this.connectionName);
|
|
sb.append('[');
|
|
sb.append(i);
|
|
sb.append("] onReset");
|
|
taskQueue.schedule(new Task(sb.toString(), true, this, i, errorCode) { // from class: okhttp3.internal.http2.Http2Connection$pushResetLater$$inlined$execute$default$1
|
|
final boolean $cancelable;
|
|
final ErrorCode $errorCode$inlined;
|
|
final String $name;
|
|
final int $streamId$inlined;
|
|
final Http2Connection this$0;
|
|
|
|
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
|
|
{
|
|
super(r1, r2);
|
|
this.$name = r1;
|
|
this.$cancelable = r2;
|
|
this.this$0 = this;
|
|
this.$streamId$inlined = i;
|
|
this.$errorCode$inlined = errorCode;
|
|
}
|
|
|
|
@Override // okhttp3.internal.concurrent.Task
|
|
public final long runOnce() {
|
|
PushObserver pushObserver;
|
|
Set set;
|
|
pushObserver = this.this$0.pushObserver;
|
|
pushObserver.onReset(this.$streamId$inlined, this.$errorCode$inlined);
|
|
synchronized (this.this$0) {
|
|
set = this.this$0.currentPushRequests;
|
|
set.remove(Integer.valueOf(this.$streamId$inlined));
|
|
C14866gag c14866gag = C14866gag.c;
|
|
}
|
|
return -1L;
|
|
}
|
|
}, 0L);
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static abstract class Listener {
|
|
public static final Companion Companion = new Companion(null);
|
|
public static final Listener REFUSE_INCOMING_STREAMS = new Listener() { // from class: okhttp3.internal.http2.Http2Connection$Listener$Companion$REFUSE_INCOMING_STREAMS$1
|
|
@Override // okhttp3.internal.http2.Http2Connection.Listener
|
|
public final void onStream(Http2Stream http2Stream) throws IOException {
|
|
C14957gcv.e(http2Stream, "");
|
|
http2Stream.close(ErrorCode.REFUSED_STREAM, null);
|
|
}
|
|
};
|
|
|
|
public abstract void onStream(Http2Stream http2Stream) throws IOException;
|
|
|
|
/* loaded from: classes.dex */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(C14953gcr c14953gcr) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
public void onSettings(Http2Connection http2Connection, Settings settings) {
|
|
C14957gcv.e(http2Connection, "");
|
|
C14957gcv.e(settings, "");
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes.dex */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public final Settings getDEFAULT_SETTINGS() {
|
|
return Http2Connection.DEFAULT_SETTINGS;
|
|
}
|
|
|
|
public /* synthetic */ Companion(C14953gcr c14953gcr) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
static {
|
|
Settings settings = new Settings();
|
|
settings.set(7, 65535);
|
|
settings.set(5, 16384);
|
|
DEFAULT_SETTINGS = settings;
|
|
}
|
|
|
|
public final void awaitPong() throws InterruptedException {
|
|
synchronized (this) {
|
|
while (this.awaitPongsReceived < this.awaitPingsSent) {
|
|
wait();
|
|
}
|
|
}
|
|
}
|
|
|
|
public final void close$okhttp(ErrorCode errorCode, ErrorCode errorCode2, IOException iOException) {
|
|
int i;
|
|
Object[] objArr;
|
|
C14957gcv.e(errorCode, "");
|
|
C14957gcv.e(errorCode2, "");
|
|
if (!Util.assertionsEnabled || !Thread.holdsLock(this)) {
|
|
try {
|
|
shutdown(errorCode);
|
|
} catch (IOException unused) {
|
|
}
|
|
synchronized (this) {
|
|
if (!getStreams$okhttp().isEmpty()) {
|
|
objArr = getStreams$okhttp().values().toArray(new Http2Stream[0]);
|
|
if (objArr != null) {
|
|
getStreams$okhttp().clear();
|
|
} else {
|
|
throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T of kotlin.collections.ArraysKt__ArraysJVMKt.toTypedArray>");
|
|
}
|
|
} else {
|
|
objArr = null;
|
|
}
|
|
C14866gag c14866gag = C14866gag.c;
|
|
}
|
|
Http2Stream[] http2StreamArr = (Http2Stream[]) objArr;
|
|
if (http2StreamArr != null) {
|
|
for (Http2Stream http2Stream : http2StreamArr) {
|
|
try {
|
|
http2Stream.close(errorCode2, iOException);
|
|
} catch (IOException unused2) {
|
|
}
|
|
}
|
|
}
|
|
try {
|
|
getWriter().close();
|
|
} catch (IOException unused3) {
|
|
}
|
|
try {
|
|
getSocket$okhttp().close();
|
|
} catch (IOException unused4) {
|
|
}
|
|
this.writerQueue.shutdown();
|
|
this.pushQueue.shutdown();
|
|
this.settingsListenerQueue.shutdown();
|
|
return;
|
|
}
|
|
StringBuilder sb = new StringBuilder("Thread ");
|
|
sb.append((Object) Thread.currentThread().getName());
|
|
sb.append(" MUST NOT hold lock on ");
|
|
sb.append(this);
|
|
throw new AssertionError(sb.toString());
|
|
}
|
|
|
|
public final void start(boolean z) throws IOException {
|
|
start$default(this, z, null, 2, null);
|
|
}
|
|
|
|
public final void start() throws IOException {
|
|
start$default(this, false, null, 3, null);
|
|
}
|
|
|
|
public final void setPeerSettings(Settings settings) {
|
|
C14957gcv.e(settings, "");
|
|
this.peerSettings = settings;
|
|
}
|
|
|
|
public final void setNextStreamId$okhttp(int i) {
|
|
this.nextStreamId = i;
|
|
}
|
|
|
|
public final void setLastGoodStreamId$okhttp(int i) {
|
|
this.lastGoodStreamId = i;
|
|
}
|
|
|
|
public final Http2Writer getWriter() {
|
|
return this.writer;
|
|
}
|
|
|
|
public final long getWriteBytesTotal() {
|
|
return this.writeBytesTotal;
|
|
}
|
|
|
|
public final long getWriteBytesMaximum() {
|
|
return this.writeBytesMaximum;
|
|
}
|
|
|
|
public final Map<Integer, Http2Stream> getStreams$okhttp() {
|
|
return this.streams;
|
|
}
|
|
|
|
public final Socket getSocket$okhttp() {
|
|
return this.socket;
|
|
}
|
|
|
|
public final ReaderRunnable getReaderRunnable() {
|
|
return this.readerRunnable;
|
|
}
|
|
|
|
public final long getReadBytesTotal() {
|
|
return this.readBytesTotal;
|
|
}
|
|
|
|
public final long getReadBytesAcknowledged() {
|
|
return this.readBytesAcknowledged;
|
|
}
|
|
|
|
public final Settings getPeerSettings() {
|
|
return this.peerSettings;
|
|
}
|
|
|
|
public final Settings getOkHttpSettings() {
|
|
return this.okHttpSettings;
|
|
}
|
|
|
|
public final int getNextStreamId$okhttp() {
|
|
return this.nextStreamId;
|
|
}
|
|
|
|
public final Listener getListener$okhttp() {
|
|
return this.listener;
|
|
}
|
|
|
|
public final int getLastGoodStreamId$okhttp() {
|
|
return this.lastGoodStreamId;
|
|
}
|
|
|
|
public final String getConnectionName$okhttp() {
|
|
return this.connectionName;
|
|
}
|
|
|
|
public final boolean getClient$okhttp() {
|
|
return this.client;
|
|
}
|
|
}
|