From 1f621300f6f38f2ad71cffd5cd0f46fd92b6b2c8 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sat, 22 Aug 2020 02:40:35 -0400 Subject: [PATCH] Revert #338 This is creating more problems than it actually solves --- .../velocitypowered/api/proxy/config/ProxyConfig.java | 7 ------- .../proxy/config/VelocityConfiguration.java | 11 ----------- .../proxy/connection/client/LoginSessionHandler.java | 8 -------- .../proxy/network/ServerChannelInitializer.java | 2 +- proxy/src/main/resources/default-velocity.toml | 3 --- 5 files changed, 1 insertion(+), 30 deletions(-) diff --git a/api/src/main/java/com/velocitypowered/api/proxy/config/ProxyConfig.java b/api/src/main/java/com/velocitypowered/api/proxy/config/ProxyConfig.java index da3a44208..3efa22c78 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/config/ProxyConfig.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/config/ProxyConfig.java @@ -150,11 +150,4 @@ public interface ProxyConfig { * @return read timeout (in milliseconds) */ int getReadTimeout(); - - /** - * Get how long this proxy will wait until performing an initial read timeout. - * - * @return read timeout (in milliseconds) - */ - int getInitialReadTimeout(); } diff --git a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java index 4d678f406..5c2da244d 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java @@ -329,11 +329,6 @@ public class VelocityConfiguration implements ProxyConfig { return advanced.getReadTimeout(); } - @Override - public int getInitialReadTimeout() { - return advanced.getInitialReadTimeout(); - } - public boolean isProxyProtocol() { return advanced.isProxyProtocol(); } @@ -627,7 +622,6 @@ public class VelocityConfiguration implements ProxyConfig { private boolean failoverOnUnexpectedServerDisconnect = true; private boolean announceProxyCommands = true; private boolean logCommandExecutions = false; - private int initialReadTimeout = 3000; private Advanced() { } @@ -647,7 +641,6 @@ public class VelocityConfiguration implements ProxyConfig { .getOrElse("failover-on-unexpected-server-disconnect", true); this.announceProxyCommands = config.getOrElse("announce-proxy-commands", true); this.logCommandExecutions = config.getOrElse("log-command-executions", false); - this.initialReadTimeout = config.getIntOrElse("initial-read-timeout", 3000); } } @@ -699,10 +692,6 @@ public class VelocityConfiguration implements ProxyConfig { return logCommandExecutions; } - public int getInitialReadTimeout() { - return initialReadTimeout; - } - @Override public String toString() { return "Advanced{" diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java index c0f7c2f9e..ac3e9eec7 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java @@ -25,7 +25,6 @@ import com.velocitypowered.proxy.config.PlayerInfoForwarding; import com.velocitypowered.proxy.config.VelocityConfiguration; import com.velocitypowered.proxy.connection.MinecraftConnection; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; -import com.velocitypowered.proxy.network.Connections; import com.velocitypowered.proxy.protocol.StateRegistry; import com.velocitypowered.proxy.protocol.packet.Disconnect; import com.velocitypowered.proxy.protocol.packet.EncryptionRequest; @@ -34,7 +33,6 @@ import com.velocitypowered.proxy.protocol.packet.ServerLogin; import com.velocitypowered.proxy.protocol.packet.ServerLoginSuccess; import com.velocitypowered.proxy.protocol.packet.SetCompression; import io.netty.buffer.ByteBuf; -import io.netty.handler.timeout.ReadTimeoutHandler; import java.net.InetSocketAddress; import java.security.GeneralSecurityException; import java.security.KeyPair; @@ -200,12 +198,6 @@ public class LoginSessionHandler implements MinecraftSessionHandler { } private void initializePlayer(GameProfile profile, boolean onlineMode) { - // Restore normal timeout for connection. - mcConnection.getChannel().pipeline() - .replace(Connections.READ_TIMEOUT, Connections.READ_TIMEOUT, - new ReadTimeoutHandler(server.getConfiguration().getReadTimeout(), - TimeUnit.MILLISECONDS)); - // Some connection types may need to alter the game profile. profile = mcConnection.getType().addGameProfileTokensIfRequired(profile, server.getConfiguration().getPlayerInfoForwardingMode()); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializer.java b/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializer.java index 1f97fd1ec..64d2ec835 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializer.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/ServerChannelInitializer.java @@ -37,7 +37,7 @@ public class ServerChannelInitializer extends ChannelInitializer { protected void initChannel(final Channel ch) { ch.pipeline() .addLast(READ_TIMEOUT, - new ReadTimeoutHandler(this.server.getConfiguration().getInitialReadTimeout(), + new ReadTimeoutHandler(this.server.getConfiguration().getReadTimeout(), TimeUnit.MILLISECONDS)) .addLast(LEGACY_PING_DECODER, new LegacyPingDecoder()) .addLast(FRAME_DECODER, new MinecraftVarintFrameDecoder()) diff --git a/proxy/src/main/resources/default-velocity.toml b/proxy/src/main/resources/default-velocity.toml index 0b2dbdfb8..c29cb1d01 100644 --- a/proxy/src/main/resources/default-velocity.toml +++ b/proxy/src/main/resources/default-velocity.toml @@ -105,9 +105,6 @@ connection-timeout = 5000 # Specify a read timeout for connections here. The default is 30 seconds. read-timeout = 30000 -# Specify an initial read timeout for connections here. The default is 3 seconds. -initial-read-timeout = 3000 - # Enables compatibility with HAProxy. proxy-protocol = false