larksuite-oapi/src/main/java/com/larksuite/oapi/okhttp3_14/internal/http2/Http2Stream.java
private void emitFrame(boolean outFinishedOnLastFrame) throws IOException {
      long toWrite;
      synchronized (Http2Stream.this) {
        writeTimeout.enter();
        try {
          while (bytesLeftInWriteWindow <= 0 && !finished && !closed && errorCode == null) {
            waitForIo(); // Wait until we receive a WINDOW_UPDATE for this stream.
          }
        } finally {
          writeTimeout.exitAndThrowIfTimedOut();
        }

        checkOutNotClosed(); // Kick out if the stream was reset or closed while waiting.
        toWrite = Math.min(bytesLeftInWriteWindow, sendBuffer.size());
        bytesLeftInWriteWindow -= toWrite;
      }

      writeTimeout.enter();
      try {
        boolean outFinished = outFinishedOnLastFrame && toWrite == sendBuffer.size();
        connection.writeData(id, outFinished, sendBuffer, toWrite);
      } finally {
        writeTimeout.exitAndThrowIfTimedOut();
      }
    }
/**
     * Emit a single data frame to the connection. The frame's size be limited by this stream's
     * write window. This method will block until the write window is nonempty.
     */
Emit a single data frame to the connection. The frame's size be limited by this stream's
write window. This method will block until the write window is nonempty.
Emit a single data frame to the connection . The frame ' s size be limited by this stream ' s write window . This method will block until the write window is nonempty .
private void emitFrame(boolean outFinishedOnLastFrame) throws IOException {
      long toWrite;
      synchronized (Http2Stream.this) {
        writeTimeout.enter();
        try {
          while (bytesLeftInWriteWindow <= 0 && !finished && !closed && errorCode == null) {
            waitForIo(); 
          }
        } finally {
          writeTimeout.exitAndThrowIfTimedOut();
        }
        checkOutNotClosed(); 
        toWrite = Math.min(bytesLeftInWriteWindow, sendBuffer.size());
        bytesLeftInWriteWindow -= toWrite;
      }
      writeTimeout.enter();
      try {
        boolean outFinished = outFinishedOnLastFrame && toWrite == sendBuffer.size();
        connection.writeData(id, outFinished, sendBuffer, toWrite);
      } finally {
        writeTimeout.exitAndThrowIfTimedOut();
      }
    }
private void emitFrame ( boolean outFinishedOnLastFrame ) throws IOException { long toWrite ; synchronized ( Http2Stream . this ) { writeTimeout . enter ( ) ; try { while ( bytesLeftInWriteWindow <= 0 && ! finished && ! closed && errorCode == null ) { waitForIo ( ) ; } } finally { writeTimeout . exitAndThrowIfTimedOut ( ) ; } checkOutNotClosed ( ) ; toWrite = Math . min ( bytesLeftInWriteWindow , sendBuffer . size ( ) ) ; bytesLeftInWriteWindow -= toWrite ; } writeTimeout . enter ( ) ; try { boolean outFinished = outFinishedOnLastFrame && toWrite == sendBuffer . size ( ) ; connection . writeData ( id , outFinished , sendBuffer , toWrite ) ; } finally { writeTimeout . exitAndThrowIfTimedOut ( ) ; } }
Emit a single data frame to the connection.
Emit a single data frame to the connection .
// Wait until we receive a WINDOW_UPDATE for this stream. // Kick out if the stream was reset or closed while waiting.