Fix client connection

This commit is contained in:
Andrea Cavalli 2024-10-04 01:16:47 +02:00
parent 310f94d473
commit 47c3e31f75

View File

@ -75,8 +75,16 @@ public class GrpcConnection extends BaseConnection implements RocksDBAPI {
private GrpcConnection(String name, SocketAddress socketAddress, URI address) { private GrpcConnection(String name, SocketAddress socketAddress, URI address) {
super(name); super(name);
var channelBuilder = NettyChannelBuilder NettyChannelBuilder channelBuilder;
.forAddress(socketAddress) if (socketAddress instanceof InetSocketAddress inetSocketAddress) {
channelBuilder = NettyChannelBuilder
.forAddress(inetSocketAddress.getHostString(), inetSocketAddress.getPort());
} else {
channelBuilder = NettyChannelBuilder
.forAddress(socketAddress);
}
channelBuilder
.directExecutor() .directExecutor()
.usePlaintext(); .usePlaintext();
if (socketAddress instanceof DomainSocketAddress _) { if (socketAddress instanceof DomainSocketAddress _) {