Fix buffer-joins-to-world patch

Dieser Commit ist enthalten in:
Nassim Jahnke 2022-12-21 22:55:42 +01:00
Ursprung 94373f0143
Commit 7b52db5f61
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
4 geänderte Dateien mit 32 neuen und 28 gelöschten Zeilen

Datei anzeigen

@ -440,7 +440,7 @@ index 0000000000000000000000000000000000000000..c2dca89291361d60cbf160cab77749cb
+} +}
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..56a5e20c47e2ee2169611e20969803bcfd75f88f index 0000000000000000000000000000000000000000..52b02cb1f02d1c65b840f38cfc8baee500aa2259
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -0,0 +1,277 @@ @@ -0,0 +1,277 @@
@ -709,7 +709,7 @@ index 0000000000000000000000000000000000000000..56a5e20c47e2ee2169611e20969803bc
+ // TODO: FILL + // TODO: FILL
+ } + }
+ } + }
+ public int maxJoinsPerTick = 3; + public int maxJoinsPerTick = 5;
+ public boolean fixEntityPositionDesync = true; + public boolean fixEntityPositionDesync = true;
+ public boolean loadPermissionsYmlBeforePlugins = true; + public boolean loadPermissionsYmlBeforePlugins = true;
+ @Constraints.Min(4) + @Constraints.Min(4)
@ -4423,7 +4423,7 @@ index 7c35fb22df0bca2c2ca885a872ee42d6073d852f..26fc8127024d7b81ffe5c1c81b8ef8a6
} }
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 5efdc61dfa1a8d74fead69e76425a45cd97783d5..caae5d862461c7dcf5fa9bf36e51276925668945 100644 index 16a2efb7dcbcafca867fd75972a0bd80937b95a8..ae219be37c5fcec3dd3f8b08819551003e66d351 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -230,7 +230,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -230,7 +230,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@ -4464,7 +4464,7 @@ index bf6f50cfe5225804ae2cab4f50bcc7ee2ddfe36e..ca5cbd7c43d7e263f76d8719a259514c
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env); this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 030b852353f831a64a9466a2cfdfb0cd76243d8d..64db49f699ebd0baf1cce79c1ef20c5b7a83f2b3 100644 index 9afc0881f6891ef2696b6f2b37c0826f3beb0666..8873bf84c71c48297a360df9c99e511fa0af5b40 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -885,6 +885,7 @@ public final class CraftServer implements Server { @@ -885,6 +885,7 @@ public final class CraftServer implements Server {
@ -4476,7 +4476,7 @@ index 030b852353f831a64a9466a2cfdfb0cd76243d8d..64db49f699ebd0baf1cce79c1ef20c5b
world.serverLevelData.setDifficulty(config.difficulty); world.serverLevelData.setDifficulty(config.difficulty);
world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals); world.setSpawnSettings(config.spawnMonsters, config.spawnAnimals);
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 68aafbe2ff05ad2c48b8f3ed23d779680bca574a..a857f9e20d2fe0f495df884e81489e89a64bea54 100644 index 16c38195c3e4f5550122df0d65fcce8ca3a83822..1d4f6e7fcfaaee40b06f74d250d04f7a36b6458b 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -131,6 +131,19 @@ public class Main { @@ -131,6 +131,19 @@ public class Main {

Datei anzeigen

@ -8,10 +8,10 @@ the world per tick, this attempts to reduce the impact that join floods
has on the server has on the server
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index d032f8d011b94f396c9d5606f42a8c331db62740..4487b4329cf09a6538e272c44207dda492ceb099 100644 index d032f8d011b94f396c9d5606f42a8c331db62740..501d17ba798c5928279a93c45de3eb6e8a3f99d6 100644
--- a/src/main/java/net/minecraft/network/Connection.java --- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java
@@ -433,8 +433,23 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -433,14 +433,29 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} }
// Paper end // Paper end
@ -21,17 +21,23 @@ index d032f8d011b94f396c9d5606f42a8c331db62740..4487b4329cf09a6538e272c44207dda4
public void tick() { public void tick() {
this.flushQueue(); this.flushQueue();
+ // Paper start + // Paper start
+ if (currTick != net.minecraft.server.MinecraftServer.currentTick) { + if (Connection.currTick != net.minecraft.server.MinecraftServer.currentTick) {
+ currTick = net.minecraft.server.MinecraftServer.currentTick; + Connection.currTick = net.minecraft.server.MinecraftServer.currentTick;
+ joinAttemptsThisTick = 0; + Connection.joinAttemptsThisTick = 0;
+ } + }
+ // Paper end + // Paper end
+ if (this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl) {
+ if ( ((net.minecraft.server.network.ServerLoginPacketListenerImpl) this.packetListener).state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper
+ || (joinAttemptsThisTick++ < MAX_PER_TICK)) { // Paper - limit the number of joins which can be processed each tick
+ ((net.minecraft.server.network.ServerLoginPacketListenerImpl) this.packetListener).tick();
+ } // Paper
+ }
PacketListener packetlistener = this.packetListener; PacketListener packetlistener = this.packetListener;
if (packetlistener instanceof TickablePacketListener) { if (packetlistener instanceof TickablePacketListener) {
TickablePacketListener tickablepacketlistener = (TickablePacketListener) packetlistener;
+ // Paper start - limit the number of joins which can be processed each tick
+ if (!(this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginPacketListener)
+ || loginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT
+ || Connection.joinAttemptsThisTick++ < MAX_PER_TICK) {
tickablepacketlistener.tick();
+ }
+ // Paper end
}
if (!this.isConnected() && !this.disconnectionHandled) {

Datei anzeigen

@ -7,25 +7,23 @@ Subject: [PATCH] Detail more information in watchdog dumps
- Dump player name, player uuid, position, and world for packet handling - Dump player name, player uuid, position, and world for packet handling
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index b996b5c6a8dccd122fbb5d04f446927ae788bad5..8ba85f8b36b06ce5047b2587018a49dc50207866 100644 index 3355d0d75675e2f9a62c4681871ba0f403073286..46153b8e5823959e17621bbebd414d8998b77fb5 100644
--- a/src/main/java/net/minecraft/network/Connection.java --- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java
@@ -512,9 +512,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -512,7 +512,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
PacketListener packetlistener = this.packetListener; if (!(this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginPacketListener)
|| loginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT
if (packetlistener instanceof TickablePacketListener) { || Connection.joinAttemptsThisTick++ < MAX_PER_TICK) {
+ // Paper start - detailed watchdog information + // Paper start - detailed watchdog information
+ net.minecraft.network.protocol.PacketUtils.packetProcessing.push(this.packetListener); + net.minecraft.network.protocol.PacketUtils.packetProcessing.push(this.packetListener);
+ try { // Paper end - detailed watchdog information + try { // Paper end - detailed watchdog information
TickablePacketListener tickablepacketlistener = (TickablePacketListener) packetlistener;
tickablepacketlistener.tick(); tickablepacketlistener.tick();
+ } finally { // Paper start - detailed watchdog information + } finally { // Paper start - detailed watchdog information
+ net.minecraft.network.protocol.PacketUtils.packetProcessing.pop(); + net.minecraft.network.protocol.PacketUtils.packetProcessing.pop();
+ } // Paper start - detailed watchdog information + } // Paper end - detailed watchdog information
}
// Paper end
} }
if (!this.isConnected() && !this.disconnectionHandled) {
diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java diff --git a/src/main/java/net/minecraft/network/protocol/PacketUtils.java b/src/main/java/net/minecraft/network/protocol/PacketUtils.java
index acfa1907bfc9c29d261cfccc00d65bad9ad1a002..d6f3869f5725c7f081efb7f486f74dbb99d4d005 100644 index acfa1907bfc9c29d261cfccc00d65bad9ad1a002..d6f3869f5725c7f081efb7f486f74dbb99d4d005 100644
--- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java --- a/src/main/java/net/minecraft/network/protocol/PacketUtils.java

Datei anzeigen

@ -22,7 +22,7 @@ is actually processed, this is honestly really just exposed for the misnomers or
who just wanna ensure that this won't grow over a specific size if chat gets stupidly active who just wanna ensure that this won't grow over a specific size if chat gets stupidly active
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 56a5e20c47e2ee2169611e20969803bcfd75f88f..63ec2ebb71aa0e0dbb64bbce7cd3c9494e9ce2e7 100644 index 52b02cb1f02d1c65b840f38cfc8baee500aa2259..8d442c5a498ecf288a0cc0c54889c6e2fda849ce 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -254,13 +254,26 @@ public class GlobalConfiguration extends ConfigurationPart { @@ -254,13 +254,26 @@ public class GlobalConfiguration extends ConfigurationPart {
@ -52,4 +52,4 @@ index 56a5e20c47e2ee2169611e20969803bcfd75f88f..63ec2ebb71aa0e0dbb64bbce7cd3c949
+ executor.setMaximumPoolSize(_chatExecutorMaxSize); + executor.setMaximumPoolSize(_chatExecutorMaxSize);
} }
} }
public int maxJoinsPerTick = 3; public int maxJoinsPerTick = 5;