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.Http2LifecycleManager
private boolean
private static final io.netty.util.internal.logging.InternalLogger
private final int
private int
private 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.ChannelPromise
handleOutstandingControlFrames
(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise) void
lifecycleManager
(io.netty.handler.codec.http2.Http2LifecycleManager lifecycleManager) io.netty.channel.ChannelFuture
writePing
(io.netty.channel.ChannelHandlerContext ctx, boolean ack, long data, io.netty.channel.ChannelPromise promise) io.netty.channel.ChannelFuture
writeRstStream
(io.netty.channel.ChannelHandlerContext ctx, int streamId, long errorCode, io.netty.channel.ChannelPromise promise) io.netty.channel.ChannelFuture
writeSettingsAck
(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, remoteSettings
Methods inherited from class io.netty.handler.codec.http2.DecoratingHttp2FrameWriter
close, configuration, writeData, writeFrame, writeGoAway, writeHeaders, writeHeaders, writePriority, writePushPromise, writeSettings, writeWindowUpdate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.netty.handler.codec.http2.Http2ConnectionEncoder
writeFrame
Methods inherited from interface io.netty.handler.codec.http2.Http2DataWriter
writeData
Methods 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:
lifecycleManager
in interfaceio.netty.handler.codec.http2.Http2ConnectionEncoder
- Overrides:
lifecycleManager
in 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:
writeSettingsAck
in interfaceio.netty.handler.codec.http2.Http2FrameWriter
- Overrides:
writeSettingsAck
in 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:
writePing
in interfaceio.netty.handler.codec.http2.Http2FrameWriter
- Overrides:
writePing
in 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:
writeRstStream
in interfaceio.netty.handler.codec.http2.Http2FrameWriter
- Overrides:
writeRstStream
in classio.netty.handler.codec.http2.DecoratingHttp2FrameWriter
-
handleOutstandingControlFrames
private io.netty.channel.ChannelPromise handleOutstandingControlFrames(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)
-