From 11928f373753817553ea43ee737afcf1e5985251 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Wed, 12 May 2021 09:15:37 -0400 Subject: [PATCH] Fix warning when using a Unix domain socket to connect to a server --- .../velocitypowered/proxy/network/ConnectionManager.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java b/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java index 2b7bcddf6..a93cf0a52 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java @@ -182,13 +182,15 @@ public final class ConnectionManager { public Bootstrap createWorker(@Nullable EventLoopGroup group, SocketAddress target) { Bootstrap bootstrap = new Bootstrap() .channelFactory(this.transportType.getClientChannelFactory(target)) - .option(ChannelOption.TCP_NODELAY, true) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, this.server.configuration().getConnectTimeout()) .group(group == null ? this.workerGroup : group) .resolver(this.resolver.asGroup()); - if (transportType == TransportType.EPOLL && server.configuration().useTcpFastOpen()) { - bootstrap.option(EpollChannelOption.TCP_FASTOPEN_CONNECT, true); + if (target instanceof InetSocketAddress) { + bootstrap.option(ChannelOption.TCP_NODELAY, true); + if (transportType == TransportType.EPOLL && server.configuration().useTcpFastOpen()) { + bootstrap.option(EpollChannelOption.TCP_FASTOPEN_CONNECT, true); + } } return bootstrap; }