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:
Ursprung
af5e8a83ca
Commit
7fc14d8956
@ -253,6 +253,11 @@ public class GeyserSpongeConfiguration implements GeyserConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMtu() {
|
||||
return node.getNode("mtu").getInt(1400);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getConfigVersion() {
|
||||
return node.getNode("config-version").getInt(0);
|
||||
|
@ -27,6 +27,7 @@ package org.geysermc.connector;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.nukkitx.network.raknet.RakNetConstants;
|
||||
import com.nukkitx.protocol.bedrock.BedrockPacketCodec;
|
||||
import com.nukkitx.protocol.bedrock.BedrockServer;
|
||||
import com.nukkitx.protocol.bedrock.v407.Bedrock_v407;
|
||||
@ -168,6 +169,10 @@ public class GeyserConnector {
|
||||
if (config.isAboveBedrockNetherBuilding())
|
||||
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.setHandler(new ConnectorServerEventHandler(this));
|
||||
bedrockServer.bind().whenComplete((avoid, throwable) -> {
|
||||
|
@ -118,6 +118,8 @@ public interface GeyserConfiguration {
|
||||
String getUniqueId();
|
||||
}
|
||||
|
||||
int getMtu();
|
||||
|
||||
int getConfigVersion();
|
||||
|
||||
static void checkGeyserConfiguration(GeyserConfiguration geyserConfig, GeyserLogger geyserLogger) {
|
||||
|
@ -138,6 +138,9 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
|
||||
private String uniqueId;
|
||||
}
|
||||
|
||||
@JsonProperty("mtu")
|
||||
private int mtu = 1400;
|
||||
|
||||
@JsonProperty("config-version")
|
||||
private int configVersion;
|
||||
}
|
||||
|
@ -110,5 +110,9 @@ metrics:
|
||||
# UUID of server, don't change!
|
||||
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
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren