From 06cb19ca08be277d002b5e9d8d7e0f491580434e Mon Sep 17 00:00:00 2001 From: Max Lambrecht Date: Mon, 18 May 2020 13:14:48 -0300 Subject: [PATCH 1/3] Avoid netty warning by setting unknown channel option to null Signed-off-by: Max Lambrecht --- build.gradle | 2 +- .../java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 10654c7b..f3c45385 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'spiffe' -version '0.5.0' +version '0.5.1' buildscript { repositories { diff --git a/src/main/java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java b/src/main/java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java index a00b20b4..284cf7de 100644 --- a/src/main/java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java +++ b/src/main/java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java @@ -3,6 +3,7 @@ import io.grpc.*; import io.grpc.netty.NegotiationType; import io.grpc.netty.NettyChannelBuilder; +import io.netty.channel.ChannelOption; import io.netty.channel.epoll.EpollDomainSocketChannel; import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.kqueue.KQueueDomainSocketChannel; @@ -107,6 +108,8 @@ private static void configureNativeSocketChannel(NettyChannelBuilder channelBuil checkNotNull(channelBuilder, "Channel builder is Null"); if (SystemUtils.IS_OS_LINUX) { channelBuilder.eventLoopGroup(new EpollEventLoopGroup()) + // avoid Unknown channel option 'SO_KEEPALIVE' + .withOption(ChannelOption.SO_KEEPALIVE, null) .channelType(EpollDomainSocketChannel.class); } else if (SystemUtils.IS_OS_MAC) { channelBuilder.eventLoopGroup(new KQueueEventLoopGroup()) From 2e645a0bacdc2792226b86a138d7704528d6cedd Mon Sep 17 00:00:00 2001 From: Max Lambrecht Date: Mon, 18 May 2020 13:20:53 -0300 Subject: [PATCH 2/3] Avoid netty warning by setting unknown channel option to null, for both linux and mac. Signed-off-by: Max Lambrecht --- .../java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java b/src/main/java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java index 284cf7de..7e78943f 100644 --- a/src/main/java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java +++ b/src/main/java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java @@ -109,11 +109,12 @@ private static void configureNativeSocketChannel(NettyChannelBuilder channelBuil if (SystemUtils.IS_OS_LINUX) { channelBuilder.eventLoopGroup(new EpollEventLoopGroup()) // avoid Unknown channel option 'SO_KEEPALIVE' - .withOption(ChannelOption.SO_KEEPALIVE, null) - .channelType(EpollDomainSocketChannel.class); + .withOption(ChannelOption.SO_KEEPALIVE, null) + .channelType(EpollDomainSocketChannel.class); } else if (SystemUtils.IS_OS_MAC) { channelBuilder.eventLoopGroup(new KQueueEventLoopGroup()) - .channelType(KQueueDomainSocketChannel.class); + .withOption(ChannelOption.SO_KEEPALIVE, null) + .channelType(KQueueDomainSocketChannel.class); } else { channelBuilder.eventLoopGroup(new NioEventLoopGroup()); } From c1cdce9c79767a2b07770f3e295512e0c9515442 Mon Sep 17 00:00:00 2001 From: Max Lambrecht Date: Mon, 18 May 2020 13:24:45 -0300 Subject: [PATCH 3/3] Minor format fix Signed-off-by: Max Lambrecht --- .../java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java b/src/main/java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java index 7e78943f..b730caf6 100644 --- a/src/main/java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java +++ b/src/main/java/spiffe/api/svid/SpiffeEndpointChannelBuilder.java @@ -108,12 +108,12 @@ private static void configureNativeSocketChannel(NettyChannelBuilder channelBuil checkNotNull(channelBuilder, "Channel builder is Null"); if (SystemUtils.IS_OS_LINUX) { channelBuilder.eventLoopGroup(new EpollEventLoopGroup()) - // avoid Unknown channel option 'SO_KEEPALIVE' + // avoid Unknown channel option 'SO_KEEPALIVE' .withOption(ChannelOption.SO_KEEPALIVE, null) .channelType(EpollDomainSocketChannel.class); } else if (SystemUtils.IS_OS_MAC) { channelBuilder.eventLoopGroup(new KQueueEventLoopGroup()) - .withOption(ChannelOption.SO_KEEPALIVE, null) + .withOption(ChannelOption.SO_KEEPALIVE, null) .channelType(KQueueDomainSocketChannel.class); } else { channelBuilder.eventLoopGroup(new NioEventLoopGroup());