You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by ms...@apache.org on 2019/07/26 15:54:10 UTC

[incubator-ratis] branch master updated: RATIS-606. GrpcService should use SO_REUSEADDR flag. Contributed by Mukul Kumar Singh.

This is an automated email from the ASF dual-hosted git repository.

msingh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ratis.git


The following commit(s) were added to refs/heads/master by this push:
     new 08aa862  RATIS-606. GrpcService should use SO_REUSEADDR flag. Contributed by Mukul Kumar Singh.
08aa862 is described below

commit 08aa862d00ad5dd9ecc5a39ee4899358b6f12a55
Author: Mukul Kumar Singh <ms...@apache.org>
AuthorDate: Fri Jul 26 21:23:47 2019 +0530

    RATIS-606. GrpcService should use SO_REUSEADDR flag. Contributed by Mukul Kumar Singh.
---
 ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcService.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcService.java b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcService.java
index 973dff4..f42d356 100644
--- a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcService.java
+++ b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcService.java
@@ -30,6 +30,7 @@ import org.apache.ratis.server.impl.RaftServerRpcWithProxy;
 import org.apache.ratis.thirdparty.io.grpc.netty.GrpcSslContexts;
 import org.apache.ratis.thirdparty.io.grpc.netty.NettyServerBuilder;
 import org.apache.ratis.thirdparty.io.grpc.Server;
+import org.apache.ratis.thirdparty.io.netty.channel.ChannelOption;
 import org.apache.ratis.thirdparty.io.netty.handler.ssl.ClientAuth;
 import org.apache.ratis.thirdparty.io.netty.handler.ssl.SslContextBuilder;
 
@@ -109,6 +110,7 @@ public class GrpcService extends RaftServerRpcWithProxy<GrpcServerProtocolClient
     this.clientProtocolService = new GrpcClientProtocolService(idSupplier, raftServer);
 
     NettyServerBuilder nettyServerBuilder = NettyServerBuilder.forPort(port)
+        .withChildOption(ChannelOption.SO_REUSEADDR, true)
         .maxInboundMessageSize(grpcMessageSizeMax.getSizeInt())
         .flowControlWindow(flowControlWindow.getSizeInt())
         .addService(new GrpcServerProtocolService(idSupplier, raftServer))