diff --git a/dubbo-remoting/dubbo-remoting-http3/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyHttp3Server.java b/dubbo-remoting/dubbo-remoting-http3/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyHttp3Server.java index acda515e097..cf12616ed12 100644 --- a/dubbo-remoting/dubbo-remoting-http3/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyHttp3Server.java +++ b/dubbo-remoting/dubbo-remoting-http3/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyHttp3Server.java @@ -83,8 +83,8 @@ protected void doOpen() throws Throwable { @Override protected void initChannel(QuicChannel ch) { ChannelPipeline pipeline = ch.pipeline(); - pipeline.addLast(nettyServerHandler); pipelineConfigurator.accept(pipeline); + pipeline.addLast(nettyServerHandler); } }) .build()) diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/AddressUtils.java b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/AddressUtils.java index a4c623e67af..6746e339d31 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/AddressUtils.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/AddressUtils.java @@ -59,38 +59,6 @@ public static InetSocketAddress getLocalAddress(Channel channel) { return (InetSocketAddress) channel.localAddress(); } - public static String getRemoteAddressKey(Channel channel) { - InetSocketAddress address; - for (int i = 0, size = ACCESSORS.size(); i < size; i++) { - ChannelAddressAccessor accessor = ACCESSORS.get(i); - address = accessor.getRemoteAddress(channel); - if (address != null) { - return accessor.getProtocol() + ' ' + toAddressString(address); - } - } - InetSocketAddress remoteAddress = (InetSocketAddress) channel.remoteAddress(); - if (remoteAddress == null) { - return "UNKNOWN"; - } - return toAddressString(remoteAddress); - } - - public static String getLocalAddressKey(Channel channel) { - InetSocketAddress address; - for (int i = 0, size = ACCESSORS.size(); i < size; i++) { - ChannelAddressAccessor accessor = ACCESSORS.get(i); - address = accessor.getLocalAddress(channel); - if (address != null) { - return accessor.getProtocol() + ' ' + toAddressString(address); - } - } - SocketAddress localAddress = channel.localAddress(); - if (localAddress == null) { - return "UNKNOWN"; - } - return toAddressString((InetSocketAddress) localAddress); - } - static void initAddressIfNecessary(NettyChannel nettyChannel) { Channel channel = nettyChannel.getNioChannel(); SocketAddress address = channel.localAddress(); @@ -122,12 +90,18 @@ static InetSocketAddress getRemoteAddress(NettyChannel channel) { static String getLocalAddressKey(NettyChannel channel) { InetSocketAddress address = getLocalAddress(channel); + if (address == null) { + return "UNKNOWN"; + } String protocol = (String) channel.getAttribute(PROTOCOL_KEY); return protocol == null ? toAddressString(address) : protocol + ' ' + toAddressString(address); } static String getRemoteAddressKey(NettyChannel channel) { InetSocketAddress address = getRemoteAddress(channel); + if (address == null) { + return "UNKNOWN"; + } String protocol = (String) channel.getAttribute(PROTOCOL_KEY); return protocol == null ? toAddressString(address) : protocol + ' ' + toAddressString(address); }