From 83b04d03f62b1178c5d8a0a41a67fe08d350e081 Mon Sep 17 00:00:00 2001 From: WJL3333 Date: Mon, 13 Sep 2021 13:55:35 +0800 Subject: [PATCH] [ISSUE #3346]Avoid double parse remoteAddr in rpcHook call --- .../rocketmq/remoting/netty/NettyRemotingAbstract.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java index c9b39946..b2e7294b 100644 --- a/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java +++ b/remoting/src/main/java/org/apache/rocketmq/remoting/netty/NettyRemotingAbstract.java @@ -199,11 +199,12 @@ public abstract class NettyRemotingAbstract { @Override public void run() { try { - doBeforeRpcHooks(RemotingHelper.parseChannelRemoteAddr(ctx.channel()), cmd); + String remoteAddr = RemotingHelper.parseChannelRemoteAddr(ctx.channel()); + doBeforeRpcHooks(remoteAddr, cmd); final RemotingResponseCallback callback = new RemotingResponseCallback() { @Override public void callback(RemotingCommand response) { - doAfterRpcHooks(RemotingHelper.parseChannelRemoteAddr(ctx.channel()), cmd, response); + doAfterRpcHooks(remoteAddr, cmd, response); if (!cmd.isOnewayRPC()) { if (response != null) { response.setOpaque(opaque); -- GitLab