This is an automated email from the ASF dual-hosted git repository.

earthchen pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.2 by this push:
     new 02e486a1dc Fix unable to receive go away frame (#13228)
02e486a1dc is described below

commit 02e486a1dccef10a03b81575fb3b7158d3cd9299
Author: Albumen Kevin <[email protected]>
AuthorDate: Wed Oct 18 11:38:57 2023 +0800

    Fix unable to receive go away frame (#13228)
    
    * Fix unable to receive go away frame
    
    * Rename
    
    * rename
---
 .../java/org/apache/dubbo/remoting/Constants.java  |  3 +++
 .../transport/netty4/NettyConnectionClient.java    |  3 ++-
 .../rpc/protocol/tri/TripleHttp2Protocol.java      | 27 +++++++++++-----------
 ...ClientHandler.java => TripleGoAwayHandler.java} | 12 ++++------
 4 files changed, 23 insertions(+), 22 deletions(-)

diff --git 
a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java
 
b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java
index ae7ab3f682..4ffe4b0b17 100644
--- 
a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java
+++ 
b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java
@@ -178,4 +178,7 @@ public interface Constants {
     String CONTENT_LENGTH_KEY = "content-length";
 
     String USE_SECURE_RANDOM_ID = 
"dubbo.application.use-secure-random-request-id";
+
+    String CONNECTION_HANDLER_NAME = "connectionHandler";
+
 }
diff --git 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java
 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java
index d60807f836..a86e9634c5 100644
--- 
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java
+++ 
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java
@@ -23,6 +23,7 @@ import org.apache.dubbo.common.logger.LoggerFactory;
 import org.apache.dubbo.common.utils.NetUtils;
 import org.apache.dubbo.remoting.Channel;
 import org.apache.dubbo.remoting.ChannelHandler;
+import org.apache.dubbo.remoting.Constants;
 import org.apache.dubbo.remoting.RemotingException;
 import org.apache.dubbo.remoting.api.WireProtocol;
 import org.apache.dubbo.remoting.api.connection.AbstractConnectionClient;
@@ -123,7 +124,7 @@ public class NettyConnectionClient extends 
AbstractConnectionClient {
                 int heartbeat = UrlUtils.getHeartbeat(getUrl());
                 pipeline.addLast("client-idle-handler", new 
IdleStateHandler(heartbeat, 0, 0, MILLISECONDS));
 
-                pipeline.addLast("connectionHandler", connectionHandler);
+                pipeline.addLast(Constants.CONNECTION_HANDLER_NAME, 
connectionHandler);
 
                 NettyConfigOperator operator = new 
NettyConfigOperator(nettyChannel, getChannelHandler());
                 protocol.configClientPipeline(getUrl(), operator, 
nettySslContextOperator);
diff --git 
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java
 
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java
index 4a07c30706..70d018d78a 100644
--- 
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java
+++ 
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java
@@ -17,15 +17,6 @@
 
 package org.apache.dubbo.rpc.protocol.tri;
 
-import io.netty.channel.ChannelInitializer;
-import io.netty.channel.ChannelPipeline;
-import io.netty.handler.codec.http2.Http2FrameCodec;
-import io.netty.handler.codec.http2.Http2FrameLogger;
-import io.netty.handler.codec.http2.Http2MultiplexHandler;
-import io.netty.handler.codec.http2.Http2Settings;
-import io.netty.handler.codec.http2.Http2StreamChannel;
-import io.netty.handler.flush.FlushConsolidationHandler;
-import io.netty.handler.logging.LogLevel;
 import org.apache.dubbo.common.URL;
 import org.apache.dubbo.common.config.Configuration;
 import org.apache.dubbo.common.config.ConfigurationUtils;
@@ -42,13 +33,24 @@ import org.apache.dubbo.rpc.HeaderFilter;
 import org.apache.dubbo.rpc.executor.ExecutorSupport;
 import org.apache.dubbo.rpc.model.FrameworkModel;
 import org.apache.dubbo.rpc.model.ScopeModelAware;
-import org.apache.dubbo.rpc.protocol.tri.transport.TripleClientHandler;
 import 
org.apache.dubbo.rpc.protocol.tri.transport.TripleCommandOutBoundHandler;
+import org.apache.dubbo.rpc.protocol.tri.transport.TripleGoAwayHandler;
 import 
org.apache.dubbo.rpc.protocol.tri.transport.TripleHttp2FrameServerHandler;
 import 
org.apache.dubbo.rpc.protocol.tri.transport.TripleServerConnectionHandler;
 import org.apache.dubbo.rpc.protocol.tri.transport.TripleTailHandler;
 import org.apache.dubbo.rpc.protocol.tri.transport.TripleWriteQueue;
 
+import io.netty.channel.ChannelDuplexHandler;
+import io.netty.channel.ChannelInitializer;
+import io.netty.channel.ChannelPipeline;
+import io.netty.handler.codec.http2.Http2FrameCodec;
+import io.netty.handler.codec.http2.Http2FrameLogger;
+import io.netty.handler.codec.http2.Http2MultiplexHandler;
+import io.netty.handler.codec.http2.Http2Settings;
+import io.netty.handler.codec.http2.Http2StreamChannel;
+import io.netty.handler.flush.FlushConsolidationHandler;
+import io.netty.handler.logging.LogLevel;
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -161,11 +163,10 @@ public class TripleHttp2Protocol extends 
AbstractWireProtocol implements ScopeMo
             .frameLogger(CLIENT_LOGGER)
             .build();
         
codec.connection().local().flowController().frameWriter(codec.encoder().frameWriter());
-        final Http2MultiplexHandler handler = new Http2MultiplexHandler(
-            new TripleClientHandler(frameworkModel));
         List<ChannelHandler> handlers = new ArrayList<>();
         handlers.add(new ChannelHandlerPretender(codec));
-        handlers.add(new ChannelHandlerPretender(handler));
+        handlers.add(new ChannelHandlerPretender(new Http2MultiplexHandler(new 
ChannelDuplexHandler())));
+        handlers.add(new ChannelHandlerPretender(new TripleGoAwayHandler()));
         handlers.add(new ChannelHandlerPretender(new 
TriplePingPongHandler(UrlUtils.getCloseTimeout(url))));
         handlers.add(new ChannelHandlerPretender(new TripleTailHandler()));
         operator.configChannelHandler(handlers);
diff --git 
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleClientHandler.java
 
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleGoAwayHandler.java
similarity index 77%
rename from 
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleClientHandler.java
rename to 
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleGoAwayHandler.java
index daa7e1921c..234d9b341b 100644
--- 
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleClientHandler.java
+++ 
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleGoAwayHandler.java
@@ -17,28 +17,24 @@
 
 package org.apache.dubbo.rpc.protocol.tri.transport;
 
+import org.apache.dubbo.remoting.Constants;
 import org.apache.dubbo.remoting.api.connection.ConnectionHandler;
-import org.apache.dubbo.rpc.model.FrameworkModel;
 
 import io.netty.channel.ChannelDuplexHandler;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.handler.codec.http2.Http2GoAwayFrame;
 import io.netty.util.ReferenceCountUtil;
 
-public class TripleClientHandler extends ChannelDuplexHandler {
+public class TripleGoAwayHandler extends ChannelDuplexHandler {
 
-    private final FrameworkModel frameworkModel;
 
-    private static final String CONNECTION_HANDLER_NAME = "connectionHandler";
-
-    public TripleClientHandler(FrameworkModel frameworkModel) {
-        this.frameworkModel = frameworkModel;
+    public TripleGoAwayHandler() {
     }
 
     @Override
     public void channelRead(ChannelHandlerContext ctx, Object msg) throws 
Exception {
         if (msg instanceof Http2GoAwayFrame) {
-            final ConnectionHandler connectionHandler = (ConnectionHandler) 
ctx.pipeline().get(CONNECTION_HANDLER_NAME);
+            final ConnectionHandler connectionHandler = (ConnectionHandler) 
ctx.pipeline().get(Constants.CONNECTION_HANDLER_NAME);
             connectionHandler.onGoAway(ctx.channel());
         }
         ReferenceCountUtil.release(msg);

Reply via email to