From 79b73a7dafa1409780b8733453e3ce26dbf4e024 Mon Sep 17 00:00:00 2001 From: "shengwei.psw" Date: Sun, 17 Jan 2021 20:12:07 +0800 Subject: [PATCH] #2 --- .../dubbo/remoting/api/PortUnificationServer.java | 1 + .../dubbo/rpc/protocol/tri/TripleClientHandler.java | 5 +++++ .../tri/TripleHttp2ClientResponseHandler.java | 11 +++++++++++ 3 files changed, 17 insertions(+) diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/PortUnificationServer.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/PortUnificationServer.java index cd93078b726..fa4e8a82627 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/PortUnificationServer.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/PortUnificationServer.java @@ -153,6 +153,7 @@ protected void doClose() throws Throwable { } channelGroup.close(); + Thread.sleep(15000); } catch (Throwable e) { logger.warn(e.getMessage(), e); } diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleClientHandler.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleClientHandler.java index 21588832fa2..6daeadf2226 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleClientHandler.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleClientHandler.java @@ -1,5 +1,6 @@ package org.apache.dubbo.rpc.protocol.tri; +import org.apache.dubbo.remoting.api.Connection; import org.apache.dubbo.remoting.exchange.Request; import io.netty.channel.ChannelDuplexHandler; @@ -28,6 +29,10 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception System.out.println("Http2 Setting"); }else if(msg instanceof Http2GoAwayFrame){ System.out.println("Http2 goAway!"); + final Connection connection = Connection.getConnectionFromChannel(ctx.channel()); + if (connection != null) { + connection.onIdle(); + } } } diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2ClientResponseHandler.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2ClientResponseHandler.java index 2c22c4d4262..70f66fae38e 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2ClientResponseHandler.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2ClientResponseHandler.java @@ -1,5 +1,6 @@ package org.apache.dubbo.rpc.protocol.tri; +import io.netty.handler.codec.http2.Http2GoAwayFrame; import org.apache.dubbo.common.logger.Logger; import org.apache.dubbo.common.logger.LoggerFactory; @@ -16,6 +17,16 @@ public TripleHttp2ClientResponseHandler() { super(false); } + @Override + public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { + super.userEventTriggered(ctx, evt); + if (evt instanceof Http2GoAwayFrame) { + System.out.println("TripleHttp2ClientResponseHandler goaway!!!"); + //todo set stream refuse + ctx.close(); + } + } + @Override protected void channelRead0(ChannelHandlerContext ctx, Http2StreamFrame msg) throws Exception { if (msg instanceof Http2HeadersFrame) {