forked from GeyserMC/Geyser
Add customizable MTU support (#1068)
* Add customizable MTU support Fixes clients being unable to connect in rare instances. * Make config.yml nicer
This commit is contained in:
parent
af5e8a83ca
commit
7fc14d8956
5 changed files with 20 additions and 1 deletions
|
@ -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);
|
||||||
|
|
|
@ -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) -> {
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue