13
0
geforkt von Mirrors/Velocity

Change to a 5 second connection timeout.

Dieser Commit ist enthalten in:
PurpleIsEverything 2018-09-13 22:53:23 -06:00
Ursprung 14590ca3ea
Commit cf46659d9e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4BB5E7264CEF9EFA
3 geänderte Dateien mit 4 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -33,6 +33,7 @@ import static com.velocitypowered.proxy.network.Connections.HANDLER;
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER; import static com.velocitypowered.proxy.network.Connections.MINECRAFT_DECODER;
import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER; import static com.velocitypowered.proxy.network.Connections.MINECRAFT_ENCODER;
import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT; import static com.velocitypowered.proxy.network.Connections.READ_TIMEOUT;
import static com.velocitypowered.proxy.network.Connections.CONNECTION_TIMEOUT_SECONDS;
import static com.velocitypowered.proxy.network.Connections.SERVER_READ_TIMEOUT_SECONDS; import static com.velocitypowered.proxy.network.Connections.SERVER_READ_TIMEOUT_SECONDS;
public class VelocityServerConnection implements MinecraftConnectionAssociation, ServerConnection { public class VelocityServerConnection implements MinecraftConnectionAssociation, ServerConnection {
@ -56,7 +57,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
CompletableFuture<ConnectionRequestBuilder.Result> result = new CompletableFuture<>(); CompletableFuture<ConnectionRequestBuilder.Result> result = new CompletableFuture<>();
server.initializeGenericBootstrap() server.initializeGenericBootstrap()
.option(ChannelOption.TCP_NODELAY, true) .option(ChannelOption.TCP_NODELAY, true)
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, SERVER_READ_TIMEOUT_SECONDS * 1000) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECTION_TIMEOUT_SECONDS * 1000)
.handler(new ChannelInitializer<Channel>() { .handler(new ChannelInitializer<Channel>() {
@Override @Override
protected void initChannel(Channel ch) throws Exception { protected void initChannel(Channel ch) throws Exception {

Datei anzeigen

@ -89,7 +89,7 @@ public final class ConnectionManager {
ch.pipeline().addLast(Connections.HANDLER, connection); ch.pipeline().addLast(Connections.HANDLER, connection);
} }
}) })
.childOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, CLIENT_READ_TIMEOUT_SECONDS * 1000) .childOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECTION_TIMEOUT_SECONDS * 1000)
.childOption(ChannelOption.TCP_NODELAY, true) .childOption(ChannelOption.TCP_NODELAY, true)
.childOption(ChannelOption.IP_TOS, 0x18) .childOption(ChannelOption.IP_TOS, 0x18)
.localAddress(address); .localAddress(address);

Datei anzeigen

@ -16,4 +16,5 @@ public interface Connections {
int CLIENT_READ_TIMEOUT_SECONDS = 30; // client -> proxy int CLIENT_READ_TIMEOUT_SECONDS = 30; // client -> proxy
int SERVER_READ_TIMEOUT_SECONDS = 30; // proxy -> server int SERVER_READ_TIMEOUT_SECONDS = 30; // proxy -> server
int CONNECTION_TIMEOUT_SECONDS = 5;
} }