[ISSUE #5291] Optimize the NettyRemotingServer. (#5299)

This commit is contained in:
echooymxq
2022-10-14 13:10:23 +08:00
committed by GitHub
parent db1f1839b9
commit dd4ebd0a90
@@ -452,10 +452,7 @@ public class NettyRemotingServer extends NettyRemotingAbstract implements Remoti
@Override
protected void channelRead0(ChannelHandlerContext ctx, ByteBuf msg) {
// mark the current position so that we can peek the first byte to determine if the content is starting with
// TLS handshake
msg.markReaderIndex();
// Peek the first byte to determine if the content is starting with TLS handshake
byte b = msg.getByte(0);
if (b == HANDSHAKE_MAGIC_CODE) {
@@ -486,9 +483,6 @@ public class NettyRemotingServer extends NettyRemotingAbstract implements Remoti
log.warn("Clients intend to establish an insecure connection while this server is running in SSL enforcing mode");
}
// reset the reader index so that handshake negotiation may proceed as normal.
msg.resetReaderIndex();
try {
// Remove this handler
ctx.pipeline().remove(this);