mirror of
https://github.com/PaperMC/Velocity.git
synced 2024-11-27 06:30:35 +08:00
parent
c47d25c88a
commit
1f621300f6
@ -150,11 +150,4 @@ public interface ProxyConfig {
|
|||||||
* @return read timeout (in milliseconds)
|
* @return read timeout (in milliseconds)
|
||||||
*/
|
*/
|
||||||
int getReadTimeout();
|
int getReadTimeout();
|
||||||
|
|
||||||
/**
|
|
||||||
* Get how long this proxy will wait until performing an initial read timeout.
|
|
||||||
*
|
|
||||||
* @return read timeout (in milliseconds)
|
|
||||||
*/
|
|
||||||
int getInitialReadTimeout();
|
|
||||||
}
|
}
|
||||||
|
@ -329,11 +329,6 @@ public class VelocityConfiguration implements ProxyConfig {
|
|||||||
return advanced.getReadTimeout();
|
return advanced.getReadTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getInitialReadTimeout() {
|
|
||||||
return advanced.getInitialReadTimeout();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isProxyProtocol() {
|
public boolean isProxyProtocol() {
|
||||||
return advanced.isProxyProtocol();
|
return advanced.isProxyProtocol();
|
||||||
}
|
}
|
||||||
@ -627,7 +622,6 @@ public class VelocityConfiguration implements ProxyConfig {
|
|||||||
private boolean failoverOnUnexpectedServerDisconnect = true;
|
private boolean failoverOnUnexpectedServerDisconnect = true;
|
||||||
private boolean announceProxyCommands = true;
|
private boolean announceProxyCommands = true;
|
||||||
private boolean logCommandExecutions = false;
|
private boolean logCommandExecutions = false;
|
||||||
private int initialReadTimeout = 3000;
|
|
||||||
|
|
||||||
private Advanced() {
|
private Advanced() {
|
||||||
}
|
}
|
||||||
@ -647,7 +641,6 @@ public class VelocityConfiguration implements ProxyConfig {
|
|||||||
.getOrElse("failover-on-unexpected-server-disconnect", true);
|
.getOrElse("failover-on-unexpected-server-disconnect", true);
|
||||||
this.announceProxyCommands = config.getOrElse("announce-proxy-commands", true);
|
this.announceProxyCommands = config.getOrElse("announce-proxy-commands", true);
|
||||||
this.logCommandExecutions = config.getOrElse("log-command-executions", false);
|
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;
|
return logCommandExecutions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInitialReadTimeout() {
|
|
||||||
return initialReadTimeout;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Advanced{"
|
return "Advanced{"
|
||||||
|
@ -25,7 +25,6 @@ import com.velocitypowered.proxy.config.PlayerInfoForwarding;
|
|||||||
import com.velocitypowered.proxy.config.VelocityConfiguration;
|
import com.velocitypowered.proxy.config.VelocityConfiguration;
|
||||||
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
import com.velocitypowered.proxy.connection.MinecraftConnection;
|
||||||
import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
|
import com.velocitypowered.proxy.connection.MinecraftSessionHandler;
|
||||||
import com.velocitypowered.proxy.network.Connections;
|
|
||||||
import com.velocitypowered.proxy.protocol.StateRegistry;
|
import com.velocitypowered.proxy.protocol.StateRegistry;
|
||||||
import com.velocitypowered.proxy.protocol.packet.Disconnect;
|
import com.velocitypowered.proxy.protocol.packet.Disconnect;
|
||||||
import com.velocitypowered.proxy.protocol.packet.EncryptionRequest;
|
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.ServerLoginSuccess;
|
||||||
import com.velocitypowered.proxy.protocol.packet.SetCompression;
|
import com.velocitypowered.proxy.protocol.packet.SetCompression;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
|
||||||
import java.net.InetSocketAddress;
|
import java.net.InetSocketAddress;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.security.KeyPair;
|
import java.security.KeyPair;
|
||||||
@ -200,12 +198,6 @@ public class LoginSessionHandler implements MinecraftSessionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initializePlayer(GameProfile profile, boolean onlineMode) {
|
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.
|
// Some connection types may need to alter the game profile.
|
||||||
profile = mcConnection.getType().addGameProfileTokensIfRequired(profile,
|
profile = mcConnection.getType().addGameProfileTokensIfRequired(profile,
|
||||||
server.getConfiguration().getPlayerInfoForwardingMode());
|
server.getConfiguration().getPlayerInfoForwardingMode());
|
||||||
|
@ -37,7 +37,7 @@ public class ServerChannelInitializer extends ChannelInitializer<Channel> {
|
|||||||
protected void initChannel(final Channel ch) {
|
protected void initChannel(final Channel ch) {
|
||||||
ch.pipeline()
|
ch.pipeline()
|
||||||
.addLast(READ_TIMEOUT,
|
.addLast(READ_TIMEOUT,
|
||||||
new ReadTimeoutHandler(this.server.getConfiguration().getInitialReadTimeout(),
|
new ReadTimeoutHandler(this.server.getConfiguration().getReadTimeout(),
|
||||||
TimeUnit.MILLISECONDS))
|
TimeUnit.MILLISECONDS))
|
||||||
.addLast(LEGACY_PING_DECODER, new LegacyPingDecoder())
|
.addLast(LEGACY_PING_DECODER, new LegacyPingDecoder())
|
||||||
.addLast(FRAME_DECODER, new MinecraftVarintFrameDecoder())
|
.addLast(FRAME_DECODER, new MinecraftVarintFrameDecoder())
|
||||||
|
@ -105,9 +105,6 @@ connection-timeout = 5000
|
|||||||
# Specify a read timeout for connections here. The default is 30 seconds.
|
# Specify a read timeout for connections here. The default is 30 seconds.
|
||||||
read-timeout = 30000
|
read-timeout = 30000
|
||||||
|
|
||||||
# Specify an initial read timeout for connections here. The default is 3 seconds.
|
|
||||||
initial-read-timeout = 3000
|
|
||||||
|
|
||||||
# Enables compatibility with HAProxy.
|
# Enables compatibility with HAProxy.
|
||||||
proxy-protocol = false
|
proxy-protocol = false
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user