From a91598b193c567f7bdda42f5dad543723a647b6a Mon Sep 17 00:00:00 2001 From: "Yuan.Wang" Date: Wed, 21 Sep 2022 09:55:57 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-78074=20netty=E5=86=85=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../codec/compression/ZstdEncoder.java | 1 + .../codec/protobuf/ProtobufEncoder.java | 2 ++ .../handler/ssl/ConscryptAlpnSslEngine.java | 29 ++++++++++--------- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/fine-netty/src/main/java/io/netty/handler/codec/compression/ZstdEncoder.java b/fine-netty/src/main/java/io/netty/handler/codec/compression/ZstdEncoder.java index 411d83438..e28e02bbd 100644 --- a/fine-netty/src/main/java/io/netty/handler/codec/compression/ZstdEncoder.java +++ b/fine-netty/src/main/java/io/netty/handler/codec/compression/ZstdEncoder.java @@ -15,6 +15,7 @@ */ package io.netty.handler.codec.compression; +import com.github.luben.zstd.Zstd; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; diff --git a/fine-netty/src/main/java/io/netty/handler/codec/protobuf/ProtobufEncoder.java b/fine-netty/src/main/java/io/netty/handler/codec/protobuf/ProtobufEncoder.java index 5aa7957f1..a8a3b6ecb 100644 --- a/fine-netty/src/main/java/io/netty/handler/codec/protobuf/ProtobufEncoder.java +++ b/fine-netty/src/main/java/io/netty/handler/codec/protobuf/ProtobufEncoder.java @@ -26,6 +26,8 @@ import io.netty.handler.codec.LengthFieldBasedFrameDecoder; import io.netty.handler.codec.LengthFieldPrepender; import io.netty.handler.codec.MessageToMessageEncoder; +import static io.netty.buffer.Unpooled.*; + import java.util.List; /** diff --git a/fine-netty/src/main/java/io/netty/handler/ssl/ConscryptAlpnSslEngine.java b/fine-netty/src/main/java/io/netty/handler/ssl/ConscryptAlpnSslEngine.java index dc2f0e9c1..c6041f95c 100644 --- a/fine-netty/src/main/java/io/netty/handler/ssl/ConscryptAlpnSslEngine.java +++ b/fine-netty/src/main/java/io/netty/handler/ssl/ConscryptAlpnSslEngine.java @@ -15,26 +15,27 @@ */ package io.netty.handler.ssl; +import static io.netty.handler.ssl.SslUtils.toSSLHandshakeException; +import static io.netty.util.internal.ObjectUtil.checkNotNull; +import static java.lang.Math.min; + import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelectionListener; import io.netty.handler.ssl.JdkApplicationProtocolNegotiator.ProtocolSelector; -import io.netty.util.internal.SystemPropertyUtil; -import org.conscrypt.AllocatedBuffer; -import org.conscrypt.BufferAllocator; -import org.conscrypt.HandshakeListener; - -import javax.net.ssl.SSLEngine; -import javax.net.ssl.SSLEngineResult; -import javax.net.ssl.SSLException; import java.nio.ByteBuffer; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; +import javax.net.ssl.SSLEngine; +import javax.net.ssl.SSLEngineResult; +import javax.net.ssl.SSLException; -import static io.netty.handler.ssl.SslUtils.toSSLHandshakeException; -import static io.netty.util.internal.ObjectUtil.checkNotNull; -import static java.lang.Math.min; +import io.netty.util.internal.SystemPropertyUtil; +import org.conscrypt.AllocatedBuffer; +import org.conscrypt.BufferAllocator; +import org.conscrypt.Conscrypt; +import org.conscrypt.HandshakeListener; /** * A {@link JdkSslEngine} that uses the Conscrypt provider or SSL with ALPN. @@ -44,12 +45,12 @@ abstract class ConscryptAlpnSslEngine extends JdkSslEngine { "io.netty.handler.ssl.conscrypt.useBufferAllocator", true); static ConscryptAlpnSslEngine newClientEngine(SSLEngine engine, ByteBufAllocator alloc, - JdkApplicationProtocolNegotiator applicationNegotiator) { + JdkApplicationProtocolNegotiator applicationNegotiator) { return new ClientEngine(engine, alloc, applicationNegotiator); } static ConscryptAlpnSslEngine newServerEngine(SSLEngine engine, ByteBufAllocator alloc, - JdkApplicationProtocolNegotiator applicationNegotiator) { + JdkApplicationProtocolNegotiator applicationNegotiator) { return new ServerEngine(engine, alloc, applicationNegotiator); } @@ -96,7 +97,7 @@ abstract class ConscryptAlpnSslEngine extends JdkSslEngine { private final ProtocolSelectionListener protocolListener; ClientEngine(SSLEngine engine, ByteBufAllocator alloc, - JdkApplicationProtocolNegotiator applicationNegotiator) { + JdkApplicationProtocolNegotiator applicationNegotiator) { super(engine, alloc, applicationNegotiator.protocols()); // Register for completion of the handshake. Conscrypt.setHandshakeListener(engine, new HandshakeListener() {