Package io.grpc.netty
Class Http2ControlFrameLimitEncoder
java.lang.Object
io.netty.handler.codec.http2.DecoratingHttp2FrameWriter
io.netty.handler.codec.http2.DecoratingHttp2ConnectionEncoder
io.grpc.netty.Http2ControlFrameLimitEncoder
- All Implemented Interfaces:
io.netty.handler.codec.http2.Http2ConnectionEncoder,io.netty.handler.codec.http2.Http2DataWriter,io.netty.handler.codec.http2.Http2FrameWriter,io.netty.handler.codec.http2.Http2SettingsReceivedConsumer,Closeable,AutoCloseable
final class Http2ControlFrameLimitEncoder
extends io.netty.handler.codec.http2.DecoratingHttp2ConnectionEncoder
DecoratingHttp2ConnectionEncoder which guards against a remote peer that will trigger a massive amount
of control frames but will not consume our responses to these.
This encoder will tear-down the connection once we reached the configured limit to reduce the risk of DDOS.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.handler.codec.http2.Http2FrameWriter
io.netty.handler.codec.http2.Http2FrameWriter.Configuration -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate io.netty.handler.codec.http2.Http2LifecycleManagerprivate booleanprivate static final io.netty.util.internal.logging.InternalLoggerprivate final intprivate intprivate final io.netty.channel.ChannelFutureListener -
Constructor Summary
ConstructorsConstructorDescriptionHttp2ControlFrameLimitEncoder(io.netty.handler.codec.http2.Http2ConnectionEncoder delegate, int maxOutstandingControlFrames) -
Method Summary
Modifier and TypeMethodDescriptionprivate io.netty.channel.ChannelPromisehandleOutstandingControlFrames(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) voidlifecycleManager(io.netty.handler.codec.http2.Http2LifecycleManager lifecycleManager) io.netty.channel.ChannelFuturewritePing(io.netty.channel.ChannelHandlerContext ctx, boolean ack, long data, io.netty.channel.ChannelPromise promise) io.netty.channel.ChannelFuturewriteRstStream(io.netty.channel.ChannelHandlerContext ctx, int streamId, long errorCode, io.netty.channel.ChannelPromise promise) io.netty.channel.ChannelFuturewriteSettingsAck(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) Methods inherited from class io.netty.handler.codec.http2.DecoratingHttp2ConnectionEncoder
connection, consumeReceivedSettings, flowController, frameWriter, pollSentSettings, remoteSettingsMethods inherited from class io.netty.handler.codec.http2.DecoratingHttp2FrameWriter
close, configuration, writeData, writeFrame, writeGoAway, writeHeaders, writeHeaders, writePriority, writePushPromise, writeSettings, writeWindowUpdateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.handler.codec.http2.Http2ConnectionEncoder
writeFrameMethods inherited from interface io.netty.handler.codec.http2.Http2DataWriter
writeDataMethods inherited from interface io.netty.handler.codec.http2.Http2FrameWriter
close, configuration, writeGoAway, writeHeaders, writeHeaders, writePriority, writePushPromise, writeSettings, writeWindowUpdate
-
Field Details
-
logger
private static final io.netty.util.internal.logging.InternalLogger logger -
maxOutstandingControlFrames
private final int maxOutstandingControlFrames -
outstandingControlFramesListener
private final io.netty.channel.ChannelFutureListener outstandingControlFramesListener -
lifecycleManager
private io.netty.handler.codec.http2.Http2LifecycleManager lifecycleManager -
outstandingControlFrames
private int outstandingControlFrames -
limitReached
private boolean limitReached
-
-
Constructor Details
-
Http2ControlFrameLimitEncoder
Http2ControlFrameLimitEncoder(io.netty.handler.codec.http2.Http2ConnectionEncoder delegate, int maxOutstandingControlFrames)
-
-
Method Details
-
lifecycleManager
public void lifecycleManager(io.netty.handler.codec.http2.Http2LifecycleManager lifecycleManager) - Specified by:
lifecycleManagerin interfaceio.netty.handler.codec.http2.Http2ConnectionEncoder- Overrides:
lifecycleManagerin classio.netty.handler.codec.http2.DecoratingHttp2ConnectionEncoder
-
writeSettingsAck
public io.netty.channel.ChannelFuture writeSettingsAck(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) - Specified by:
writeSettingsAckin interfaceio.netty.handler.codec.http2.Http2FrameWriter- Overrides:
writeSettingsAckin classio.netty.handler.codec.http2.DecoratingHttp2FrameWriter
-
writePing
public io.netty.channel.ChannelFuture writePing(io.netty.channel.ChannelHandlerContext ctx, boolean ack, long data, io.netty.channel.ChannelPromise promise) - Specified by:
writePingin interfaceio.netty.handler.codec.http2.Http2FrameWriter- Overrides:
writePingin classio.netty.handler.codec.http2.DecoratingHttp2FrameWriter
-
writeRstStream
public io.netty.channel.ChannelFuture writeRstStream(io.netty.channel.ChannelHandlerContext ctx, int streamId, long errorCode, io.netty.channel.ChannelPromise promise) - Specified by:
writeRstStreamin interfaceio.netty.handler.codec.http2.Http2FrameWriter- Overrides:
writeRstStreamin classio.netty.handler.codec.http2.DecoratingHttp2FrameWriter
-
handleOutstandingControlFrames
private io.netty.channel.ChannelPromise handleOutstandingControlFrames(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)
-