From 0e689d94e2b2604a7dbd0ecd9725d1dc9c2b9fcd Mon Sep 17 00:00:00 2001 From: Lukacs Berki Date: Tue, 19 Apr 2016 08:19:23 +0000 Subject: [PATCH] Bind the gRPC command server port only to localhost. Work towards #930. -- MOS_MIGRATED_REVID=120205147 --- .../com/google/devtools/build/lib/server/GrpcServerImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java b/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java index 7eae0fbdc1bca6..58f04878733dc6 100644 --- a/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java +++ b/src/main/java/com/google/devtools/build/lib/server/GrpcServerImpl.java @@ -30,7 +30,7 @@ import com.google.protobuf.ByteString; import io.grpc.Server; -import io.grpc.ServerBuilder; +import io.grpc.netty.NettyServerBuilder; import io.grpc.stub.StreamObserver; import java.io.IOException; @@ -167,7 +167,7 @@ private static String generateCookie(SecureRandom random, int byteCount) { @Override public void serve() throws IOException { Preconditions.checkState(!serving); - server = ServerBuilder.forPort(port) + server = NettyServerBuilder.forAddress(new InetSocketAddress("localhost", port)) .addService(CommandServerGrpc.bindService(this)) .build();