mirror of
https://github.com/PaperMC/Folia.git
synced 2024-11-10 10:19:30 +01:00
6928284a56
The region shift is configurable under `grid-exponent`, which allows setting the region shift to any value in [0, 31]. Note that values above 6 affect the lock shift, as the lock shift currently is computed as max(ticket shift = 6, region shift). The shift is left configurable for now as the lower default shift of 2 may have negative performance impacts. The default region shift has been adjusted to 2 from 4, and the empty chunk buffer has been reduced to 8 from 16. These changes reduce, but do not eliminate, player spread requirements. The previous block range was around ~1500 blocks at VD = 10, but is now closer to ~900 blocks at VD = 10. This roughly reduces the area that each player uses in the regioniser by 2.5x.
43 lines
2.7 KiB
Diff
43 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Thu, 9 Mar 2023 20:50:15 -0800
|
|
Subject: [PATCH] Max pending logins
|
|
|
|
Should help the floodgates on launch
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
index 5834d5e10c0b9892f29977666e7b168a9463a3d9..5bac302f6aab2c61cba87ea3e32a260eeb0284b4 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
@@ -89,7 +89,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
|
if (this.server.getPlayerList().pushPendingJoin(name, uniqueId, this.connection)) {
|
|
// Folia end - region threading - rewrite login process
|
|
this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile));
|
|
- } // Folia - region threading - rewrite login process
|
|
+ } else { --this.tick; } // Folia - region threading - rewrite login process // Folia - max concurrent logins
|
|
}
|
|
|
|
if (this.state == ServerLoginPacketListenerImpl.State.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) {
|
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
index 184057aae74e8918bf05ab03429cb0419ae9ba06..eb797313a13b5a805f834b2e9f08989e381f0761 100644
|
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
|
@@ -171,6 +171,17 @@ public abstract class PlayerList {
|
|
conflictingId = this.connectionById.get(byId);
|
|
|
|
if (conflictingName == null && conflictingId == null) {
|
|
+ // Folia start - max concurrent login
|
|
+ int loggedInCount = 0;
|
|
+ for (Connection value : this.connectionById.values()) {
|
|
+ if (value.getPacketListener() instanceof ServerGamePacketListenerImpl) {
|
|
+ ++loggedInCount;
|
|
+ }
|
|
+ }
|
|
+ if ((this.connectionById.size() - loggedInCount) >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.maxJoinsPerTick) {
|
|
+ return false;
|
|
+ }
|
|
+ // Folia end - max concurrent login
|
|
this.connectionByName.put(userName, conn);
|
|
this.connectionById.put(byId, conn);
|
|
}
|