13
0
geforkt von Mirrors/Velocity

Merge pull request #85 from PurpleIsEverything/master

Add CONNECT_TIMEOUT_MILLIS to fix timeout errors.
Dieser Commit ist enthalten in:
Andrew Steinborn 2018-09-14 00:54:29 -04:00 committet von GitHub
Commit 7b8a215078
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 4 neuen und 0 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_ENCODER;
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;
public class VelocityServerConnection implements MinecraftConnectionAssociation, ServerConnection {
@ -56,6 +57,7 @@ public class VelocityServerConnection implements MinecraftConnectionAssociation,
CompletableFuture<ConnectionRequestBuilder.Result> result = new CompletableFuture<>();
server.initializeGenericBootstrap()
.option(ChannelOption.TCP_NODELAY, true)
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECTION_TIMEOUT_SECONDS * 1000)
.handler(new ChannelInitializer<Channel>() {
@Override
protected void initChannel(Channel ch) throws Exception {

Datei anzeigen

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

Datei anzeigen

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