Class Http2ConnectionWindow
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.micronaut.http.server.netty.handler.Http2ConnectionWindow
- All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler
@Internal
public final class Http2ConnectionWindow
extends io.netty.channel.ChannelInboundHandlerAdapter
Raises the receive window of the HTTP/2 connection as a whole (stream 0) once the connection
preface has been sent.
SETTINGS_INITIAL_WINDOW_SIZE only sets the window of each
stream; the connection window starts at Http2CodecUtil.DEFAULT_WINDOW_SIZE and can only
be raised with a WINDOW_UPDATE on stream 0.
The Http2ServerHandler does this itself. This handler is for pipelines built around
netty's Http2FrameCodec, which cannot be extended: it is
added right after the codec, raises the window and then removes itself.
- Since:
- 5.2.2
- Author:
- Graeme Rocher
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Constructor Summary
ConstructorsConstructorDescriptionHttp2ConnectionWindow(io.netty.handler.codec.http2.Http2ConnectionHandler connectionHandler, int windowSize) -
Method Summary
Modifier and TypeMethodDescriptionvoidchannelActive(io.netty.channel.ChannelHandlerContext ctx) static inteffectiveWindowSize(io.netty.handler.codec.http2.Http2Settings initialSettings, @Nullable Integer configured) Compute the connection window size to use for the given settings: the larger of the configured value and the window derived from the stream window.voidhandlerAdded(io.netty.channel.ChannelHandlerContext ctx) static voidraise(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http2.Http2Connection connection, int windowSize) Raise the connection window of the given connection towindowSizeif it is smaller, and advertise the increase to the peer right away.Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerRemoved, isSharableMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerRemoved
-
Constructor Details
-
Http2ConnectionWindow
public Http2ConnectionWindow(io.netty.handler.codec.http2.Http2ConnectionHandler connectionHandler, int windowSize) - Parameters:
connectionHandler- The connection handler whose connection window to raisewindowSize- The target window size, seeeffectiveWindowSize(Http2Settings, Integer)
-
-
Method Details
-
effectiveWindowSize
public static int effectiveWindowSize(io.netty.handler.codec.http2.Http2Settings initialSettings, @Nullable Integer configured) Compute the connection window size to use for the given settings: the larger of the configured value and the window derived from the stream window. The derived window follows the rule of netty'sHttp2FrameCodec, which raises the connection window by twice the amount the stream window exceeds the protocol default, so that a single stream cannot use up the whole connection window. The codec applies that rule on its own, so a configured value cannot go below it in the legacy pipeline; using the same floor here keeps both pipelines consistent.- Parameters:
initialSettings- The local settings sent in the prefaceconfigured- The explicitly configured connection window size, if any- Returns:
- The connection window size, at least
Http2CodecUtil.DEFAULT_WINDOW_SIZE
-
raise
public static void raise(io.netty.channel.ChannelHandlerContext ctx, io.netty.handler.codec.http2.Http2Connection connection, int windowSize) throws io.netty.handler.codec.http2.Http2Exception Raise the connection window of the given connection towindowSizeif it is smaller, and advertise the increase to the peer right away. Must be called on the event loop after the preface has been sent, so that theWINDOW_UPDATEfollows theSETTINGSframe.- Parameters:
ctx- The context of the connection handlerconnection- The connectionwindowSize- The target window size- Throws:
io.netty.handler.codec.http2.Http2Exception- If the flow controller rejects the update
-
handlerAdded
-
channelActive
-