private static void incrementLocalWindowSize(ChannelPipeline pipeline, int delta) { try { final Http2Connection connection = pipeline.get(Http2ClientConnectionHandler.class).connection(); connection.local().flowController().incrementWindowSize(connection.connectionStream(), delta); } catch (Http2Exception e) { logger.warn("Failed to increment local flowController window size: {}", delta, e); } }
private void tryExpandConnectionFlowControlWindow(Http2Connection connection) throws Http2Exception { if (initialFlowControlWindowSize != null) { // The window size in the settings explicitly excludes the connection window. So we manually manipulate the // connection window to accommodate more concurrent data per connection. Http2Stream connectionStream = connection.connectionStream(); Http2LocalFlowController localFlowController = connection.local().flowController(); final int delta = initialFlowControlWindowSize - localFlowController.initialWindowSize(connectionStream); // Only increase the connection window, don't decrease it. if (delta > 0) { // Double the delta just so a single stream can't exhaust the connection window. localFlowController.incrementWindowSize(connectionStream, Math.max(delta << 1, delta)); flush(ctx); } } }
final boolean consumeBytes(int streamId, int bytes) throws Http2Exception { Http2Stream stream = connection().stream(streamId); // Upgraded requests are ineligible for stream control. We add the null check // in case the stream has been deregistered. if (stream != null && streamId == Http2CodecUtil.HTTP_UPGRADE_STREAM_ID) { Boolean upgraded = stream.getProperty(upgradeKey); if (Boolean.TRUE.equals(upgraded)) { return false; } } return connection().local().flowController().consumeBytes(stream, bytes); }
private void increaseInitialConnectionWindow(int deltaBytes) throws Http2Exception { // The LocalFlowController is responsible for detecting over/under flow. connection().local().flowController().incrementWindowSize(connection().connectionStream(), deltaBytes); }
@Override public final Http2LocalFlowController flowController() { return connection.local().flowController(); }
final boolean isWritable(DefaultHttp2FrameStream stream) { Http2Stream s = stream.stream; return s != null && connection().remote().flowController().isWritable(s); }
public DefaultHttp2ConnectionDecoder(Http2Connection connection, Http2ConnectionEncoder encoder, Http2FrameReader frameReader, Http2PromisedRequestVerifier requestVerifier) { this.connection = checkNotNull(connection, "connection"); this.frameReader = checkNotNull(frameReader, "frameReader"); this.encoder = checkNotNull(encoder, "encoder"); this.requestVerifier = checkNotNull(requestVerifier, "requestVerifier"); if (connection.local().flowController() == null) { connection.local().flowController(new DefaultHttp2LocalFlowController(connection)); } connection.local().flowController().frameWriter(encoder.frameWriter()); }
@Override public void writabilityChanged(Http2Stream stream) { Http2FrameStream frameStream = stream.getProperty(streamKey); if (frameStream == null) { return; } onHttp2StreamWritabilityChanged( ctx, frameStream, connection().remote().flowController().isWritable(stream)); } }
final boolean consumeBytes(int streamId, int bytes) throws Http2Exception { Http2Stream stream = connection().stream(streamId); // Upgraded requests are ineligible for stream control. We add the null check // in case the stream has been deregistered. if (stream != null && streamId == Http2CodecUtil.HTTP_UPGRADE_STREAM_ID) { Boolean upgraded = stream.getProperty(upgradeKey); if (Boolean.TRUE.equals(upgraded)) { return false; } } return connection().local().flowController().consumeBytes(stream, bytes); }
private void tryExpandConnectionFlowControlWindow(Http2Connection connection) throws Http2Exception { if (initialFlowControlWindowSize != null) { // The window size in the settings explicitly excludes the connection window. So we manually manipulate the // connection window to accommodate more concurrent data per connection. Http2Stream connectionStream = connection.connectionStream(); Http2LocalFlowController localFlowController = connection.local().flowController(); final int delta = initialFlowControlWindowSize - localFlowController.initialWindowSize(connectionStream); // Only increase the connection window, don't decrease it. if (delta > 0) { // Double the delta just so a single stream can't exhaust the connection window. localFlowController.incrementWindowSize(connectionStream, Math.max(delta << 1, delta)); flush(ctx); } } }
private void increaseInitialConnectionWindow(int deltaBytes) throws Http2Exception { // The LocalFlowController is responsible for detecting over/under flow. connection().local().flowController().incrementWindowSize(connection().connectionStream(), deltaBytes); }
final boolean consumeBytes(int streamId, int bytes) throws Http2Exception { Http2Stream stream = connection().stream(streamId); // Upgraded requests are ineligible for stream control. We add the null check // in case the stream has been deregistered. if (stream != null && streamId == Http2CodecUtil.HTTP_UPGRADE_STREAM_ID) { Boolean upgraded = stream.getProperty(upgradeKey); if (Boolean.TRUE.equals(upgraded)) { return false; } } return connection().local().flowController().consumeBytes(stream, bytes); }
Http2FrameCodec(Http2ConnectionEncoder encoder, Http2ConnectionDecoder decoder, Http2Settings initialSettings) { super(decoder, encoder, initialSettings); decoder.frameListener(new FrameListener()); connection().addListener(new ConnectionListener()); connection().remote().flowController().listener(new Http2RemoteFlowControllerListener()); streamKey = connection().newKey(); upgradeKey = connection().newKey(); initialFlowControlWindowSize = initialSettings.initialWindowSize(); }
final boolean isWritable(DefaultHttp2FrameStream stream) { Http2Stream s = stream.stream; return s != null && connection().remote().flowController().isWritable(s); }
final boolean isWritable(DefaultHttp2FrameStream stream) { Http2Stream s = stream.stream; return s != null && connection().remote().flowController().isWritable(s); }
private void increaseInitialConnectionWindow(int deltaBytes) throws Http2Exception { // The LocalFlowController is responsible for detecting over/under flow. connection().local().flowController().incrementWindowSize(connection().connectionStream(), deltaBytes); }
@Override public void writabilityChanged(Http2Stream stream) { Http2FrameStream frameStream = stream.getProperty(streamKey); if (frameStream == null) { return; } onHttp2StreamWritabilityChanged( ctx, frameStream, connection().remote().flowController().isWritable(stream)); } }
Http2FrameCodec(Http2ConnectionEncoder encoder, Http2ConnectionDecoder decoder, Http2Settings initialSettings) { super(decoder, encoder, initialSettings); decoder.frameListener(new FrameListener()); connection().addListener(new ConnectionListener()); connection().remote().flowController().listener(new Http2RemoteFlowControllerListener()); streamKey = connection().newKey(); upgradeKey = connection().newKey(); initialFlowControlWindowSize = initialSettings.initialWindowSize(); }
@Override public void writabilityChanged(Http2Stream stream) { Http2FrameStream frameStream = stream.getProperty(streamKey); if (frameStream == null) { return; } onHttp2StreamWritabilityChanged( ctx, frameStream, connection().remote().flowController().isWritable(stream)); } }
public Http2ConnectionBase(ContextInternal context, VertxHttp2ConnectionHandler handler) { super(context.owner(), handler.context(), context); this.handler = handler; this.handlerContext = chctx; this.windowSize = handler.connection().local().flowController().windowSize(handler.connection().connectionStream()); this.maxConcurrentStreams = io.vertx.core.http.Http2Settings.DEFAULT_MAX_CONCURRENT_STREAMS; }