3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-11-19 14:30:17 +01:00

Add customizable MTU support (#1068)

* Add customizable MTU support

Fixes clients being unable to connect in rare instances.

* Make config.yml nicer
Dieser Commit ist enthalten in:
Camotoy 2020-07-31 19:47:23 -04:00 committet von GitHub
Ursprung af5e8a83ca
Commit 7fc14d8956
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
5 geänderte Dateien mit 20 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -253,6 +253,11 @@ public class GeyserSpongeConfiguration implements GeyserConfiguration {
} }
} }
@Override
public int getMtu() {
return node.getNode("mtu").getInt(1400);
}
@Override @Override
public int getConfigVersion() { public int getConfigVersion() {
return node.getNode("config-version").getInt(0); return node.getNode("config-version").getInt(0);

Datei anzeigen

@ -27,6 +27,7 @@ package org.geysermc.connector;
import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.nukkitx.network.raknet.RakNetConstants;
import com.nukkitx.protocol.bedrock.BedrockPacketCodec; import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
import com.nukkitx.protocol.bedrock.BedrockServer; import com.nukkitx.protocol.bedrock.BedrockServer;
import com.nukkitx.protocol.bedrock.v407.Bedrock_v407; import com.nukkitx.protocol.bedrock.v407.Bedrock_v407;
@ -168,6 +169,10 @@ public class GeyserConnector {
if (config.isAboveBedrockNetherBuilding()) if (config.isAboveBedrockNetherBuilding())
DimensionUtils.changeBedrockNetherId(); // Apply End dimension ID workaround to Nether DimensionUtils.changeBedrockNetherId(); // Apply End dimension ID workaround to Nether
// https://github.com/GeyserMC/Geyser/issues/957
RakNetConstants.MAXIMUM_MTU_SIZE = (short) config.getMtu();
logger.debug("Setting MTU to " + config.getMtu());
bedrockServer = new BedrockServer(new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort())); bedrockServer = new BedrockServer(new InetSocketAddress(config.getBedrock().getAddress(), config.getBedrock().getPort()));
bedrockServer.setHandler(new ConnectorServerEventHandler(this)); bedrockServer.setHandler(new ConnectorServerEventHandler(this));
bedrockServer.bind().whenComplete((avoid, throwable) -> { bedrockServer.bind().whenComplete((avoid, throwable) -> {

Datei anzeigen

@ -118,6 +118,8 @@ public interface GeyserConfiguration {
String getUniqueId(); String getUniqueId();
} }
int getMtu();
int getConfigVersion(); int getConfigVersion();
static void checkGeyserConfiguration(GeyserConfiguration geyserConfig, GeyserLogger geyserLogger) { static void checkGeyserConfiguration(GeyserConfiguration geyserConfig, GeyserLogger geyserLogger) {

Datei anzeigen

@ -138,6 +138,9 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
private String uniqueId; private String uniqueId;
} }
@JsonProperty("mtu")
private int mtu = 1400;
@JsonProperty("config-version") @JsonProperty("config-version")
private int configVersion; private int configVersion;
} }

Datei anzeigen

@ -110,5 +110,9 @@ metrics:
# UUID of server, don't change! # UUID of server, don't change!
uuid: generateduuid uuid: generateduuid
# DO NOT TOUCH! # ADVANCED OPTIONS - DO NOT TOUCH UNLESS YOU KNOW WHAT YOU ARE DOING!
# The internet supports a maximum MTU of 1492 but could cause issues with packet fragmentation.
# 1400 is the default.
# mtu: 1400
config-version: 3 config-version: 3