Skip to content

Commit 4ebc963

Browse files
authored
Update ShadedNettyGrpcServerFactory.java
1 parent aa286ab commit 4ebc963

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

grpc-server-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/server/serverfactory/ShadedNettyGrpcServerFactory.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
import io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts;
3535
import io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder;
36+
import io.grpc.netty.shaded.io.netty.channel.epoll.EpollServerDomainSocketChannel;
37+
import io.grpc.netty.shaded.io.netty.channel.unix.DomainSocketAddress;
3638
import io.grpc.netty.shaded.io.netty.handler.ssl.SslContextBuilder;
3739
import net.devh.boot.grpc.server.config.ClientAuth;
3840
import net.devh.boot.grpc.server.config.GrpcServerProperties;
@@ -62,7 +64,11 @@ public ShadedNettyGrpcServerFactory(final GrpcServerProperties properties,
6264
protected NettyServerBuilder newServerBuilder() {
6365
final String address = getAddress();
6466
final int port = getPort();
65-
if (GrpcServerProperties.ANY_IP_ADDRESS.equals(address)) {
67+
if (address.startsWith("unix://")) {
68+
return NettyServerBuilder
69+
.forAddress(new DomainSocketAddress(address.substring(7)))
70+
.channelType(EpollServerDomainSocketChannel.class);
71+
} else if (GrpcServerProperties.ANY_IP_ADDRESS.equals(address)) {
6672
return NettyServerBuilder.forPort(port);
6773
} else {
6874
return NettyServerBuilder.forAddress(new InetSocketAddress(InetAddresses.forString(address), port));

0 commit comments

Comments
 (0)