Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,10 @@ index b266e4f7b437578356568d86910e3b428ee66523..0b57e3bcd0319e4e9571fddbcb85db5a
.add(
new ServerBootstrap()
diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 8203765d5570644b4c8f6790f361bca2c7066b25..718f00ad9c587a4b0c12f351c10d462113f16ac3 100644
index 7e316c72ce75d55b1d93ba9c83bc86bd95bf12fa..d35001257f73b335fed241084ebdf7328c9c051f 100644
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -245,11 +245,9 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -243,11 +243,9 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
}

SecretKey secretKey = packet.getSecretKey(serverPrivateKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, TickablePacketListener {
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
private static final Logger LOGGER = LogUtils.getLogger();
+ private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newCachedThreadPool(new com.google.common.util.concurrent.ThreadFactoryBuilder().setNameFormat("User Authenticator #%d").setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).build()); // Paper - Cache authenticator threads
+ private static final java.util.concurrent.ExecutorService authenticatorPool = java.util.concurrent.Executors.newThreadPerTaskExecutor(Thread.ofVirtual().name("User Authenticator #", 0).uncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).factory()); // Paper - Virtual authenticator threads
private static final int MAX_TICKS_BEFORE_LOGIN = 600;
private final byte[] challenge;
private final MinecraftServer server;
Expand Down Expand Up @@ -104,7 +104,7 @@
this.requestedUsername = packet.name();
GameProfile singleplayerProfile = this.server.getSingleplayerProfile();
if (singleplayerProfile != null && this.requestedUsername.equalsIgnoreCase(singleplayerProfile.name())) {
@@ -127,7 +_,32 @@
@@ -127,7 +_,30 @@
this.state = ServerLoginPacketListenerImpl.State.KEY;
this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge, true));
} else {
Expand All @@ -119,8 +119,7 @@
+ return;
+ }
+ // Paper end - Add Velocity IP Forwarding Support
+ // CraftBukkit start
+ // Paper start - Cache authenticator threads
+ // Paper start - Virtual authenticator threads
+ authenticatorPool.execute(() -> {
+ try {
+ GameProfile gameprofile = ServerLoginPacketListenerImpl.this.createOfflineProfile(ServerLoginPacketListenerImpl.this.requestedUsername); // Spigot
Expand All @@ -133,8 +132,7 @@
+ ServerLoginPacketListenerImpl.this.server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + ServerLoginPacketListenerImpl.this.requestedUsername, ex);
+ }
+ });
+ // Paper end - Cache authenticator threads
+ // CraftBukkit end
+ // Paper end - Virtual authenticator threads
}
}
}
Expand Down Expand Up @@ -169,7 +167,7 @@
}

- Thread thread = new Thread("User Authenticator #" + UNIQUE_THREAD_ID.incrementAndGet()) {
+ // Paper start - Cache authenticator threads
+ // Paper start - Virtual authenticator threads
+ authenticatorPool.execute(new Runnable() {
{
Objects.requireNonNull(ServerLoginPacketListenerImpl.this);
Expand Down Expand Up @@ -222,7 +220,7 @@
- thread.start();
- }
+ });
+ // Paper end - Cache authenticator threads
+ // Paper end - Virtual authenticator threads
+ }
+
+ // CraftBukkit start
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.papermc.paper.connection;

import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.mojang.logging.LogUtils;
import io.papermc.paper.event.connection.configuration.AsyncPlayerConnectionConfigureEvent;
import java.util.concurrent.ExecutorService;
Expand All @@ -15,8 +14,9 @@
public class PaperConfigurationTask implements ConfigurationTask {
private static final Logger LOGGER = LogUtils.getClassLogger();

public static final ExecutorService CONFIGURATION_POOL = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Configuration Thread #%d")
.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).build());
public static final ExecutorService CONFIGURATION_POOL = Executors.newThreadPerTaskExecutor(
Thread.ofVirtual().name("Configuration Thread #", 0).uncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER)).factory()
);

public static final ConfigurationTask.Type TYPE = new ConfigurationTask.Type("paper_event_handling");

Expand Down
Loading