larksuite-oapi/src/main/java/com/larksuite/oapi/okhttp3_14/internal/http2/Http2Stream.java
public void writeHeaders(List<Header> responseHeaders, boolean outFinished, boolean flushHeaders)
      throws IOException {
    assert (!Thread.holdsLock(Http2Stream.this));
    if (responseHeaders == null) {
      throw new NullPointerException("headers == null");
    }
    synchronized (this) {
      this.hasResponseHeaders = true;
      if (outFinished) {
        this.sink.finished = true;
      }
    }

    // Only DATA frames are subject to flow-control. Transmit the HEADER frame if the connection
    // flow-control window is fully depleted.
    if (!flushHeaders) {
      synchronized (connection) {
        flushHeaders = connection.bytesLeftInWriteWindow == 0L;
      }
    }

    connection.writeHeaders(id, outFinished, responseHeaders);

    if (flushHeaders) {
      connection.flush();
    }
  }
/**
   * Sends a reply to an incoming stream.
   *
   * @param outFinished true to eagerly finish the output stream to send data to the remote peer.
   *     Corresponds to {@code FLAG_FIN}.
   * @param flushHeaders true to force flush the response headers. This should be true unless the
   *     response body exists and will be written immediately.
   */
Sends a reply to an incoming stream.
@param outFinished true to eagerly finish the output stream to send data to the remote peer.
Sends a reply to an incoming stream . @param outFinished true to eagerly finish the output stream to send data to the remote peer .
public void writeHeaders(List<Header> responseHeaders, boolean outFinished, boolean flushHeaders)
      throws IOException {
    assert (!Thread.holdsLock(Http2Stream.this));
    if (responseHeaders == null) {
      throw new NullPointerException("headers == null");
    }
    synchronized (this) {
      this.hasResponseHeaders = true;
      if (outFinished) {
        this.sink.finished = true;
      }
    }
    if (!flushHeaders) {
      synchronized (connection) {
        flushHeaders = connection.bytesLeftInWriteWindow == 0L;
      }
    }
    connection.writeHeaders(id, outFinished, responseHeaders);
    if (flushHeaders) {
      connection.flush();
    }
  }
public void writeHeaders ( List < Header > responseHeaders , boolean outFinished , boolean flushHeaders ) throws IOException { assert ( ! Thread . holdsLock ( Http2Stream . this ) ) ; if ( responseHeaders == null ) { throw new NullPointerException ( "headers == null" ) ; } synchronized ( this ) { this . hasResponseHeaders = true ; if ( outFinished ) { this . sink . finished = true ; } } if ( ! flushHeaders ) { synchronized ( connection ) { flushHeaders = connection . bytesLeftInWriteWindow == 0L ; } } connection . writeHeaders ( id , outFinished , responseHeaders ) ; if ( flushHeaders ) { connection . flush ( ) ; } }
Sends a reply to an incoming stream.
Sends a reply to an incoming stream .
// Only DATA frames are subject to flow-control. Transmit the HEADER frame if the connection // flow-control window is fully depleted.