Пример #1
0
  private void connected(ClientConnection conn) {
    checkThread();

    conn.setCurrentRequest(this);

    this.conn = conn;

    // If anything was written or the request ended before we got the connection, then
    // we need to write it now

    if (pendingMaxSize != -1) {
      conn.setWriteQueueMaxSize(pendingMaxSize);
    }

    if (pendingChunks != null || writeHead || completed) {
      writeHead();
      headWritten = true;
    }

    if (pendingChunks != null) {
      for (PendingChunk chunk : pendingChunks) {
        sendChunk(chunk.chunk, chunk.doneHandler);
      }
    }
    if (completed) {
      if (chunked) {
        writeEndChunk();
      }
      conn.endRequest();
    }
  }
Пример #2
0
 /**
  * Data is queued until it is actually sent. To set the point at which the queue is considered
  * "full" call this method specifying the {@code maxSize} in bytes.
  *
  * <p>This method is used by the {@link org.vertx.java.core.streams.Pump} class to pump data
  * between different streams and perform flow control.
  */
 public void setWriteQueueMaxSize(int maxSize) {
   check();
   if (conn != null) {
     conn.setWriteQueueMaxSize(maxSize);
   } else {
     pendingMaxSize = maxSize;
   }
 }