From a136a3877858a731b067a059d1b520dc21246b84 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Fri, 12 Jul 2019 18:15:06 +0200 Subject: [PATCH] Allow to disable automatically sending PING acks. (#9338) Motivation: There are situations where the user may want to be more flexible when to send the PING acks for various reasons or be able to attach a listener to the future that is used for the ping ack. To be able to do so we should allow to manage the acks manually. Modifications: - Add constructor to DefaultHttp2ConnectionDecoder that allows to disable the automatically sending of ping acks (default is to send automatically to not break users) - Add methods to AbstractHttp2ConnectionHandlerBuilder (and sub-classes) to either enable ot disable auto acks for pings - Make DefaultHttp2PingFrame constructor public that allows to write acks. - Add unit test Result: More flexible way of handling acks. --- ...AbstractHttp2ConnectionHandlerBuilder.java | 21 +++++++++++- .../http2/DefaultHttp2ConnectionDecoder.java | 34 ++++++++++++++++--- .../codec/http2/DefaultHttp2PingFrame.java | 5 +-- .../codec/http2/Http2FrameCodecBuilder.java | 7 +++- .../http2/Http2MultiplexCodecBuilder.java | 7 +++- .../codec/http2/Http2FrameCodecTest.java | 24 +++++++++++++ 6 files changed, 87 insertions(+), 11 deletions(-) diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2ConnectionHandlerBuilder.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2ConnectionHandlerBuilder.java index 08d71edd76..8b76b707e2 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2ConnectionHandlerBuilder.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/AbstractHttp2ConnectionHandlerBuilder.java @@ -106,6 +106,7 @@ public abstract class AbstractHttp2ConnectionHandlerBuilder