From 37aa1503d3168316b9e2ea2f99f8ec88271c99e2 Mon Sep 17 00:00:00 2001 From: wubin01 Date: Thu, 29 Mar 2018 17:16:24 +0800 Subject: [PATCH 1/2] mdf HandshakeHandler add test log --- .../java/org/tron/common/overlay/server/HandshakeHandler.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/tron/common/overlay/server/HandshakeHandler.java b/src/main/java/org/tron/common/overlay/server/HandshakeHandler.java index a16b553e13e..9987522c870 100644 --- a/src/main/java/org/tron/common/overlay/server/HandshakeHandler.java +++ b/src/main/java/org/tron/common/overlay/server/HandshakeHandler.java @@ -81,7 +81,8 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List ou } final HelloMessage helloMessage = (HelloMessage) msg; - + logger.info("helloMessage.getVersion() {}", helloMessage.getVersion()); + logger.info("Args.getInstance().getNodeP2pVersion() {}", Args.getInstance().getNodeP2pVersion()); if (helloMessage.getVersion() != Args.getInstance().getNodeP2pVersion()) { ctx.close(); return; From 90740a85f612a8be5403f3efcb2e28175f074dff Mon Sep 17 00:00:00 2001 From: wubin01 Date: Thu, 29 Mar 2018 17:21:15 +0800 Subject: [PATCH 2/2] mdf HelloMessage vsersion return type --- .../java/org/tron/common/overlay/message/HelloMessage.java | 2 +- .../java/org/tron/common/overlay/server/HandshakeHandler.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/tron/common/overlay/message/HelloMessage.java b/src/main/java/org/tron/common/overlay/message/HelloMessage.java index d1587ed071d..cd6038e7506 100644 --- a/src/main/java/org/tron/common/overlay/message/HelloMessage.java +++ b/src/main/java/org/tron/common/overlay/message/HelloMessage.java @@ -68,7 +68,7 @@ public byte[] getData() { * Get the version of p2p protocol. */ public int getVersion() { - return (byte) this.helloMessage.getVersion(); + return this.helloMessage.getVersion(); } /** diff --git a/src/main/java/org/tron/common/overlay/server/HandshakeHandler.java b/src/main/java/org/tron/common/overlay/server/HandshakeHandler.java index 9987522c870..a16b553e13e 100644 --- a/src/main/java/org/tron/common/overlay/server/HandshakeHandler.java +++ b/src/main/java/org/tron/common/overlay/server/HandshakeHandler.java @@ -81,8 +81,7 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List ou } final HelloMessage helloMessage = (HelloMessage) msg; - logger.info("helloMessage.getVersion() {}", helloMessage.getVersion()); - logger.info("Args.getInstance().getNodeP2pVersion() {}", Args.getInstance().getNodeP2pVersion()); + if (helloMessage.getVersion() != Args.getInstance().getNodeP2pVersion()) { ctx.close(); return;