package okhttp3.internal.http2; import java.io.EOFException; import java.io.IOException; import java.io.InterruptedIOException; import java.net.SocketTimeoutException; import java.util.ArrayDeque; import java.util.List; import o.C14866gag; import o.C14953gcr; import o.C14957gcv; import o.C15111ghZ; import o.C15139giB; import o.InterfaceC15149gid; import o.InterfaceC15168giw; import o.ghX; import o.giD; import okhttp3.Headers; import okhttp3.internal.Util; /* loaded from: classes.dex */ public final class Http2Stream { public static final Companion Companion = new Companion(null); public static final long EMIT_BUFFER_SIZE = 16384; private final Http2Connection connection; private ErrorCode errorCode; private IOException errorException; private boolean hasResponseHeaders; private final ArrayDeque headersQueue; private final int id; private long readBytesAcknowledged; private long readBytesTotal; private final StreamTimeout readTimeout; private final FramingSink sink; private final FramingSource source; private long writeBytesMaximum; private long writeBytesTotal; private final StreamTimeout writeTimeout; public Http2Stream(int i, Http2Connection http2Connection, boolean z, boolean z2, Headers headers) { C14957gcv.e(http2Connection, ""); this.id = i; this.connection = http2Connection; this.writeBytesMaximum = http2Connection.getPeerSettings().getInitialWindowSize(); ArrayDeque arrayDeque = new ArrayDeque<>(); this.headersQueue = arrayDeque; this.source = new FramingSource(this, http2Connection.getOkHttpSettings().getInitialWindowSize(), z2); this.sink = new FramingSink(this, z); this.readTimeout = new StreamTimeout(this); this.writeTimeout = new StreamTimeout(this); if (headers != null) { if (!(!isLocallyInitiated())) { throw new IllegalStateException("locally-initiated streams shouldn't have headers yet".toString()); } arrayDeque.add(headers); } else if (!isLocallyInitiated()) { throw new IllegalStateException("remotely-initiated streams should have headers".toString()); } } public final ErrorCode getErrorCode$okhttp() { ErrorCode errorCode; synchronized (this) { errorCode = this.errorCode; } return errorCode; } public final boolean isOpen() { synchronized (this) { if (this.errorCode != null) { return false; } if ((this.source.getFinished$okhttp() || this.source.getClosed$okhttp()) && (this.sink.getFinished() || this.sink.getClosed())) { if (this.hasResponseHeaders) { return false; } } return true; } } public final boolean isLocallyInitiated() { return this.connection.getClient$okhttp() == ((this.id & 1) == 1); } public final Headers takeHeaders() throws IOException { Headers headers; synchronized (this) { this.readTimeout.enter(); while (this.headersQueue.isEmpty() && this.errorCode == null) { try { waitForIo$okhttp(); } catch (Throwable th) { this.readTimeout.exitAndThrowIfTimedOut(); throw th; } } this.readTimeout.exitAndThrowIfTimedOut(); if (!(!this.headersQueue.isEmpty())) { Throwable th2 = this.errorException; if (th2 == null) { ErrorCode errorCode = this.errorCode; C14957gcv.e(errorCode); th2 = new StreamResetException(errorCode); } throw th2; } Headers removeFirst = this.headersQueue.removeFirst(); C14957gcv.c(removeFirst, ""); headers = removeFirst; } return headers; } public final Headers trailers() throws IOException { Headers trailers; synchronized (this) { if (!this.source.getFinished$okhttp() || this.source.getReceiveBuffer().c != 0 || this.source.getReadBuffer().c != 0) { if (this.errorCode == null) { throw new IllegalStateException("too early; can't read the trailers yet"); } Throwable th = this.errorException; if (th == null) { ErrorCode errorCode = this.errorCode; C14957gcv.e(errorCode); th = new StreamResetException(errorCode); } throw th; } trailers = this.source.getTrailers(); if (trailers == null) { trailers = Util.EMPTY_HEADERS; } } return trailers; } public final void enqueueTrailers(Headers headers) { C14957gcv.e(headers, ""); synchronized (this) { if (!(!getSink$okhttp().getFinished())) { throw new IllegalStateException("already finished".toString()); } if (headers.size() == 0) { throw new IllegalArgumentException("trailers.size() == 0".toString()); } getSink$okhttp().setTrailers(headers); C14866gag c14866gag = C14866gag.c; } } public final C15139giB readTimeout() { return this.readTimeout; } public final C15139giB writeTimeout() { return this.writeTimeout; } public final giD getSource() { return this.source; } public final InterfaceC15168giw getSink() { synchronized (this) { if (!this.hasResponseHeaders && !isLocallyInitiated()) { throw new IllegalStateException("reply before requesting the sink".toString()); } C14866gag c14866gag = C14866gag.c; } return this.sink; } public final void close(ErrorCode errorCode, IOException iOException) throws IOException { C14957gcv.e(errorCode, ""); if (closeInternal(errorCode, iOException)) { this.connection.writeSynReset$okhttp(this.id, errorCode); } } public final void closeLater(ErrorCode errorCode) { C14957gcv.e(errorCode, ""); if (closeInternal(errorCode, null)) { this.connection.writeSynResetLater$okhttp(this.id, errorCode); } } /* loaded from: classes.dex */ public final class FramingSource implements giD { private boolean closed; private boolean finished; private final long maxByteCount; private final C15111ghZ readBuffer; private final C15111ghZ receiveBuffer; final Http2Stream this$0; private Headers trailers; public FramingSource(Http2Stream http2Stream, long j, boolean z) { C14957gcv.e(http2Stream, ""); this.this$0 = http2Stream; this.maxByteCount = j; this.finished = z; this.receiveBuffer = new C15111ghZ(); this.readBuffer = new C15111ghZ(); } /* JADX WARN: Code restructure failed: missing block: B:46:0x00ce, code lost: throw new java.io.IOException("stream closed"); */ @Override // o.giD /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final long read(o.C15111ghZ r19, long r20) throws java.io.IOException { /* r18 = this; r1 = r18 r0 = r19 r2 = r20 java.lang.String r4 = "" o.C14957gcv.e(r0, r4) r4 = 0 int r6 = (r2 > r4 ? 1 : (r2 == r4 ? 0 : -1)) if (r6 < 0) goto Ldb L11: okhttp3.internal.http2.Http2Stream r6 = r1.this$0 monitor-enter(r6) okhttp3.internal.http2.Http2Stream$StreamTimeout r7 = r6.getReadTimeout$okhttp() // Catch: java.lang.Throwable -> Ld8 r7.enter() // Catch: java.lang.Throwable -> Ld8 okhttp3.internal.http2.ErrorCode r7 = r6.getErrorCode$okhttp() // Catch: java.lang.Throwable -> Lcf if (r7 == 0) goto L3c boolean r7 = r18.getFinished$okhttp() // Catch: java.lang.Throwable -> Lcf if (r7 != 0) goto L3c java.io.IOException r7 = r6.getErrorException$okhttp() // Catch: java.lang.Throwable -> Lcf if (r7 != 0) goto L3d okhttp3.internal.http2.StreamResetException r7 = new okhttp3.internal.http2.StreamResetException // Catch: java.lang.Throwable -> Lcf okhttp3.internal.http2.ErrorCode r8 = r6.getErrorCode$okhttp() // Catch: java.lang.Throwable -> Lcf o.C14957gcv.e(r8) // Catch: java.lang.Throwable -> Lcf r7.(r8) // Catch: java.lang.Throwable -> Lcf java.io.IOException r7 = (java.io.IOException) r7 // Catch: java.lang.Throwable -> Lcf goto L3d L3c: r7 = 0 L3d: boolean r8 = r18.getClosed$okhttp() // Catch: java.lang.Throwable -> Lcf if (r8 != 0) goto Lc7 o.ghZ r8 = r18.getReadBuffer() // Catch: java.lang.Throwable -> Lcf long r8 = r8.c // Catch: java.lang.Throwable -> Lcf int r8 = (r8 > r4 ? 1 : (r8 == r4 ? 0 : -1)) r9 = -1 r11 = 0 if (r8 <= 0) goto L9c o.ghZ r8 = r18.getReadBuffer() // Catch: java.lang.Throwable -> Lcf o.ghZ r12 = r18.getReadBuffer() // Catch: java.lang.Throwable -> Lcf long r12 = r12.c // Catch: java.lang.Throwable -> Lcf long r12 = java.lang.Math.min(r2, r12) // Catch: java.lang.Throwable -> Lcf long r12 = r8.read(r0, r12) // Catch: java.lang.Throwable -> Lcf long r14 = r6.getReadBytesTotal() // Catch: java.lang.Throwable -> Lcf long r14 = r14 + r12 r6.setReadBytesTotal$okhttp(r14) // Catch: java.lang.Throwable -> Lcf long r14 = r6.getReadBytesTotal() // Catch: java.lang.Throwable -> Lcf long r16 = r6.getReadBytesAcknowledged() // Catch: java.lang.Throwable -> Lcf long r14 = r14 - r16 if (r7 != 0) goto La9 okhttp3.internal.http2.Http2Connection r8 = r6.getConnection() // Catch: java.lang.Throwable -> Lcf okhttp3.internal.http2.Settings r8 = r8.getOkHttpSettings() // Catch: java.lang.Throwable -> Lcf int r8 = r8.getInitialWindowSize() // Catch: java.lang.Throwable -> Lcf int r8 = r8 / 2 long r4 = (long) r8 // Catch: java.lang.Throwable -> Lcf int r4 = (r14 > r4 ? 1 : (r14 == r4 ? 0 : -1)) if (r4 < 0) goto La9 okhttp3.internal.http2.Http2Connection r4 = r6.getConnection() // Catch: java.lang.Throwable -> Lcf int r5 = r6.getId() // Catch: java.lang.Throwable -> Lcf r4.writeWindowUpdateLater$okhttp(r5, r14) // Catch: java.lang.Throwable -> Lcf long r4 = r6.getReadBytesTotal() // Catch: java.lang.Throwable -> Lcf r6.setReadBytesAcknowledged$okhttp(r4) // Catch: java.lang.Throwable -> Lcf goto La9 L9c: boolean r4 = r18.getFinished$okhttp() // Catch: java.lang.Throwable -> Lcf if (r4 != 0) goto La8 if (r7 != 0) goto La8 r6.waitForIo$okhttp() // Catch: java.lang.Throwable -> Lcf r11 = 1 La8: r12 = r9 La9: okhttp3.internal.http2.Http2Stream$StreamTimeout r4 = r6.getReadTimeout$okhttp() // Catch: java.lang.Throwable -> Ld8 r4.exitAndThrowIfTimedOut() // Catch: java.lang.Throwable -> Ld8 o.gag r4 = o.C14866gag.c // Catch: java.lang.Throwable -> Ld8 monitor-exit(r6) if (r11 != 0) goto Lc3 int r0 = (r12 > r9 ? 1 : (r12 == r9 ? 0 : -1)) if (r0 == 0) goto Lbd r1.updateConnectionFlowControl(r12) return r12 Lbd: if (r7 != 0) goto Lc0 return r9 Lc0: java.lang.Throwable r7 = (java.lang.Throwable) r7 throw r7 Lc3: r4 = 0 goto L11 Lc7: java.io.IOException r0 = new java.io.IOException // Catch: java.lang.Throwable -> Lcf java.lang.String r2 = "stream closed" r0.(r2) // Catch: java.lang.Throwable -> Lcf throw r0 // Catch: java.lang.Throwable -> Lcf Lcf: r0 = move-exception okhttp3.internal.http2.Http2Stream$StreamTimeout r2 = r6.getReadTimeout$okhttp() // Catch: java.lang.Throwable -> Ld8 r2.exitAndThrowIfTimedOut() // Catch: java.lang.Throwable -> Ld8 throw r0 // Catch: java.lang.Throwable -> Ld8 Ld8: r0 = move-exception monitor-exit(r6) throw r0 Ldb: java.lang.IllegalArgumentException r0 = new java.lang.IllegalArgumentException java.lang.String r4 = "byteCount < 0: " java.lang.Long r2 = java.lang.Long.valueOf(r20) java.lang.String r2 = o.C14957gcv.c(r4, r2) java.lang.String r2 = r2.toString() r0.(r2) throw r0 */ throw new UnsupportedOperationException("Method not decompiled: okhttp3.internal.http2.Http2Stream.FramingSource.read(o.ghZ, long):long"); } @Override // o.giD public final C15139giB timeout() { return this.this$0.getReadTimeout$okhttp(); } @Override // o.giD, java.io.Closeable, java.lang.AutoCloseable public final void close() throws IOException { long j; Http2Stream http2Stream = this.this$0; synchronized (http2Stream) { setClosed$okhttp(true); j = getReadBuffer().c; C15111ghZ readBuffer = getReadBuffer(); readBuffer.j(readBuffer.c); http2Stream.notifyAll(); C14866gag c14866gag = C14866gag.c; } if (j > 0) { updateConnectionFlowControl(j); } this.this$0.cancelStreamIfNecessary$okhttp(); } private final void updateConnectionFlowControl(long j) { Http2Stream http2Stream = this.this$0; if (!Util.assertionsEnabled || !Thread.holdsLock(http2Stream)) { this.this$0.getConnection().updateConnectionFlowControl$okhttp(j); return; } StringBuilder sb = new StringBuilder("Thread "); sb.append((Object) Thread.currentThread().getName()); sb.append(" MUST NOT hold lock on "); sb.append(http2Stream); throw new AssertionError(sb.toString()); } public final void receive$okhttp(InterfaceC15149gid interfaceC15149gid, long j) throws IOException { boolean finished$okhttp; boolean z; boolean z2; long j2; C14957gcv.e(interfaceC15149gid, ""); Http2Stream http2Stream = this.this$0; if (Util.assertionsEnabled && Thread.holdsLock(http2Stream)) { StringBuilder sb = new StringBuilder("Thread "); sb.append((Object) Thread.currentThread().getName()); sb.append(" MUST NOT hold lock on "); sb.append(http2Stream); throw new AssertionError(sb.toString()); } while (j > 0) { synchronized (this.this$0) { finished$okhttp = getFinished$okhttp(); z = true; z2 = getReadBuffer().c + j > this.maxByteCount; C14866gag c14866gag = C14866gag.c; } if (z2) { interfaceC15149gid.j(j); this.this$0.closeLater(ErrorCode.FLOW_CONTROL_ERROR); return; } if (finished$okhttp) { interfaceC15149gid.j(j); return; } long read = interfaceC15149gid.read(this.receiveBuffer, j); if (read == -1) { throw new EOFException(); } j -= read; Http2Stream http2Stream2 = this.this$0; synchronized (http2Stream2) { if (!getClosed$okhttp()) { if (getReadBuffer().c != 0) { z = false; } getReadBuffer().c((giD) getReceiveBuffer()); if (z) { http2Stream2.notifyAll(); } j2 = 0; } else { j2 = getReceiveBuffer().c; C15111ghZ receiveBuffer = getReceiveBuffer(); receiveBuffer.j(receiveBuffer.c); } C14866gag c14866gag2 = C14866gag.c; } if (j2 > 0) { updateConnectionFlowControl(j2); } } } public final void setTrailers(Headers headers) { this.trailers = headers; } public final void setFinished$okhttp(boolean z) { this.finished = z; } public final void setClosed$okhttp(boolean z) { this.closed = z; } public final Headers getTrailers() { return this.trailers; } public final C15111ghZ getReceiveBuffer() { return this.receiveBuffer; } public final C15111ghZ getReadBuffer() { return this.readBuffer; } public final boolean getFinished$okhttp() { return this.finished; } public final boolean getClosed$okhttp() { return this.closed; } } /* loaded from: classes.dex */ public final class FramingSink implements InterfaceC15168giw { private boolean closed; private boolean finished; private final C15111ghZ sendBuffer; final Http2Stream this$0; private Headers trailers; public FramingSink(Http2Stream http2Stream, boolean z) { C14957gcv.e(http2Stream, ""); this.this$0 = http2Stream; this.finished = z; this.sendBuffer = new C15111ghZ(); } /* JADX WARN: 'this' call moved to the top of the method (can break code semantics) */ public /* synthetic */ FramingSink(Http2Stream http2Stream, boolean z, int i, C14953gcr c14953gcr) { this(http2Stream, (i & 1) != 0 ? false : z); this.this$0 = http2Stream; } private final void emitFrame(boolean z) throws IOException { long min; boolean z2; Http2Stream http2Stream = this.this$0; synchronized (http2Stream) { http2Stream.getWriteTimeout$okhttp().enter(); while (http2Stream.getWriteBytesTotal() >= http2Stream.getWriteBytesMaximum() && !getFinished() && !getClosed() && http2Stream.getErrorCode$okhttp() == null) { try { http2Stream.waitForIo$okhttp(); } finally { http2Stream.getWriteTimeout$okhttp().exitAndThrowIfTimedOut(); } } http2Stream.getWriteTimeout$okhttp().exitAndThrowIfTimedOut(); http2Stream.checkOutNotClosed$okhttp(); min = Math.min(http2Stream.getWriteBytesMaximum() - http2Stream.getWriteBytesTotal(), this.sendBuffer.c); http2Stream.setWriteBytesTotal$okhttp(http2Stream.getWriteBytesTotal() + min); z2 = z && min == this.sendBuffer.c; C14866gag c14866gag = C14866gag.c; } this.this$0.getWriteTimeout$okhttp().enter(); try { this.this$0.getConnection().writeData(this.this$0.getId(), z2, this.sendBuffer, min); } finally { http2Stream = this.this$0; } } @Override // o.InterfaceC15168giw public final C15139giB timeout() { return this.this$0.getWriteTimeout$okhttp(); } @Override // o.InterfaceC15168giw public final void write(C15111ghZ c15111ghZ, long j) throws IOException { C14957gcv.e(c15111ghZ, ""); Http2Stream http2Stream = this.this$0; if (!Util.assertionsEnabled || !Thread.holdsLock(http2Stream)) { this.sendBuffer.write(c15111ghZ, j); while (this.sendBuffer.c >= Http2Stream.EMIT_BUFFER_SIZE) { emitFrame(false); } } else { StringBuilder sb = new StringBuilder("Thread "); sb.append((Object) Thread.currentThread().getName()); sb.append(" MUST NOT hold lock on "); sb.append(http2Stream); throw new AssertionError(sb.toString()); } } @Override // o.InterfaceC15168giw, java.io.Flushable public final void flush() throws IOException { Http2Stream http2Stream = this.this$0; if (!Util.assertionsEnabled || !Thread.holdsLock(http2Stream)) { Http2Stream http2Stream2 = this.this$0; synchronized (http2Stream2) { http2Stream2.checkOutNotClosed$okhttp(); C14866gag c14866gag = C14866gag.c; } while (this.sendBuffer.c > 0) { emitFrame(false); this.this$0.getConnection().flush(); } return; } StringBuilder sb = new StringBuilder("Thread "); sb.append((Object) Thread.currentThread().getName()); sb.append(" MUST NOT hold lock on "); sb.append(http2Stream); throw new AssertionError(sb.toString()); } @Override // o.InterfaceC15168giw, java.io.Closeable, java.lang.AutoCloseable public final void close() throws IOException { Http2Stream http2Stream = this.this$0; if (!Util.assertionsEnabled || !Thread.holdsLock(http2Stream)) { Http2Stream http2Stream2 = this.this$0; synchronized (http2Stream2) { if (getClosed()) { return; } boolean z = http2Stream2.getErrorCode$okhttp() == null; C14866gag c14866gag = C14866gag.c; if (!this.this$0.getSink$okhttp().finished) { boolean z2 = this.sendBuffer.c > 0; if (this.trailers != null) { while (this.sendBuffer.c > 0) { emitFrame(false); } Http2Connection connection = this.this$0.getConnection(); int id = this.this$0.getId(); Headers headers = this.trailers; C14957gcv.e(headers); connection.writeHeaders$okhttp(id, z, Util.toHeaderList(headers)); } else if (z2) { while (this.sendBuffer.c > 0) { emitFrame(true); } } else if (z) { this.this$0.getConnection().writeData(this.this$0.getId(), true, null, 0L); } } synchronized (this.this$0) { setClosed(true); C14866gag c14866gag2 = C14866gag.c; } this.this$0.getConnection().flush(); this.this$0.cancelStreamIfNecessary$okhttp(); return; } } StringBuilder sb = new StringBuilder("Thread "); sb.append((Object) Thread.currentThread().getName()); sb.append(" MUST NOT hold lock on "); sb.append(http2Stream); throw new AssertionError(sb.toString()); } public final void setTrailers(Headers headers) { this.trailers = headers; } public final void setFinished(boolean z) { this.finished = z; } public final void setClosed(boolean z) { this.closed = z; } public final Headers getTrailers() { return this.trailers; } public final boolean getFinished() { return this.finished; } public final boolean getClosed() { return this.closed; } } /* loaded from: classes.dex */ public static final class Companion { private Companion() { } public /* synthetic */ Companion(C14953gcr c14953gcr) { this(); } } public final void checkOutNotClosed$okhttp() throws IOException { if (this.sink.getClosed()) { throw new IOException("stream closed"); } if (this.sink.getFinished()) { throw new IOException("stream finished"); } ErrorCode errorCode = this.errorCode; if (errorCode != null) { Throwable th = this.errorException; if (th == null) { C14957gcv.e(errorCode); th = new StreamResetException(errorCode); } throw th; } } /* loaded from: classes.dex */ public final class StreamTimeout extends ghX { final Http2Stream this$0; public StreamTimeout(Http2Stream http2Stream) { C14957gcv.e(http2Stream, ""); this.this$0 = http2Stream; } @Override // o.ghX public final void timedOut() { this.this$0.closeLater(ErrorCode.CANCEL); this.this$0.getConnection().sendDegradedPingLater$okhttp(); } @Override // o.ghX public final IOException newTimeoutException(IOException iOException) { SocketTimeoutException socketTimeoutException = new SocketTimeoutException("timeout"); if (iOException != null) { socketTimeoutException.initCause(iOException); } return socketTimeoutException; } public final void exitAndThrowIfTimedOut() throws IOException { if (exit()) { throw newTimeoutException(null); } } } public final void writeHeaders(List
list, boolean z, boolean z2) throws IOException { boolean z3; C14957gcv.e(list, ""); if (!Util.assertionsEnabled || !Thread.holdsLock(this)) { synchronized (this) { z3 = true; this.hasResponseHeaders = true; if (z) { getSink$okhttp().setFinished(true); } C14866gag c14866gag = C14866gag.c; } if (!z2) { synchronized (this.connection) { if (getConnection().getWriteBytesTotal() < getConnection().getWriteBytesMaximum()) { z3 = false; } C14866gag c14866gag2 = C14866gag.c; } z2 = z3; } this.connection.writeHeaders$okhttp(this.id, z, list); if (z2) { this.connection.flush(); return; } 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()); } private final boolean closeInternal(ErrorCode errorCode, IOException iOException) { if (!Util.assertionsEnabled || !Thread.holdsLock(this)) { synchronized (this) { if (getErrorCode$okhttp() != null) { return false; } if (getSource$okhttp().getFinished$okhttp() && getSink$okhttp().getFinished()) { return false; } setErrorCode$okhttp(errorCode); setErrorException$okhttp(iOException); notifyAll(); C14866gag c14866gag = C14866gag.c; this.connection.removeStream$okhttp(this.id); return true; } } 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 receiveData(InterfaceC15149gid interfaceC15149gid, int i) throws IOException { C14957gcv.e(interfaceC15149gid, ""); if (!Util.assertionsEnabled || !Thread.holdsLock(this)) { this.source.receive$okhttp(interfaceC15149gid, i); 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 receiveHeaders(Headers headers, boolean z) { boolean isOpen; C14957gcv.e(headers, ""); if (!Util.assertionsEnabled || !Thread.holdsLock(this)) { synchronized (this) { if (!this.hasResponseHeaders || !z) { this.hasResponseHeaders = true; this.headersQueue.add(headers); } else { getSource$okhttp().setTrailers(headers); } if (z) { getSource$okhttp().setFinished$okhttp(true); } isOpen = isOpen(); notifyAll(); C14866gag c14866gag = C14866gag.c; } if (isOpen) { return; } this.connection.removeStream$okhttp(this.id); 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 receiveRstStream(ErrorCode errorCode) { synchronized (this) { C14957gcv.e(errorCode, ""); if (this.errorCode == null) { this.errorCode = errorCode; notifyAll(); } } } public final void cancelStreamIfNecessary$okhttp() throws IOException { boolean z; boolean isOpen; if (!Util.assertionsEnabled || !Thread.holdsLock(this)) { synchronized (this) { z = !getSource$okhttp().getFinished$okhttp() && getSource$okhttp().getClosed$okhttp() && (getSink$okhttp().getFinished() || getSink$okhttp().getClosed()); isOpen = isOpen(); C14866gag c14866gag = C14866gag.c; } if (z) { close(ErrorCode.CANCEL, null); return; } else { if (isOpen) { return; } this.connection.removeStream$okhttp(this.id); 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 addBytesToWriteWindow(long j) { this.writeBytesMaximum += j; if (j > 0) { notifyAll(); } } public final void waitForIo$okhttp() throws InterruptedIOException { try { wait(); } catch (InterruptedException unused) { Thread.currentThread().interrupt(); throw new InterruptedIOException(); } } public final void setWriteBytesTotal$okhttp(long j) { this.writeBytesTotal = j; } public final void setWriteBytesMaximum$okhttp(long j) { this.writeBytesMaximum = j; } public final void setReadBytesTotal$okhttp(long j) { this.readBytesTotal = j; } public final void setReadBytesAcknowledged$okhttp(long j) { this.readBytesAcknowledged = j; } public final void setErrorException$okhttp(IOException iOException) { this.errorException = iOException; } public final void setErrorCode$okhttp(ErrorCode errorCode) { this.errorCode = errorCode; } public final StreamTimeout getWriteTimeout$okhttp() { return this.writeTimeout; } public final long getWriteBytesTotal() { return this.writeBytesTotal; } public final long getWriteBytesMaximum() { return this.writeBytesMaximum; } public final FramingSource getSource$okhttp() { return this.source; } public final FramingSink getSink$okhttp() { return this.sink; } public final StreamTimeout getReadTimeout$okhttp() { return this.readTimeout; } public final long getReadBytesTotal() { return this.readBytesTotal; } public final long getReadBytesAcknowledged() { return this.readBytesAcknowledged; } public final int getId() { return this.id; } public final IOException getErrorException$okhttp() { return this.errorException; } public final Http2Connection getConnection() { return this.connection; } }