Skip to content

Commit 02ba9b5

Browse files
committed
fix: Harden how we handle perform.login during server transition
1 parent ca8580a commit 02ba9b5

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

authme-core/src/main/java/fr/xephi/authme/data/ProxySessionManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class ProxySessionManager implements HasCleanup {
1414

1515
@Inject
1616
public ProxySessionManager() {
17-
long countTimeout = 5;
17+
long countTimeout = 15;
1818
activeProxySessions = new ExpiringMap<>(countTimeout, TimeUnit.SECONDS);
1919
}
2020

authme-velocity/src/main/java/fr/xephi/authme/velocity/VelocityProxyBridge.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -543,12 +543,6 @@ private void scheduleRetry(String normalizedName) {
543543
if (attempts == null) {
544544
return;
545545
}
546-
int current = attempts.getAndIncrement();
547-
if (current >= MAX_RETRIES) {
548-
pendingAutoLogins.remove(normalizedName);
549-
logger.warn("No auto-login ACK received for {} after {} retries; giving up", normalizedName, MAX_RETRIES);
550-
return;
551-
}
552546
Optional<Player> playerOpt = proxyServer.getPlayer(normalizedName);
553547
if (playerOpt.isEmpty()) {
554548
pendingAutoLogins.remove(normalizedName);
@@ -557,8 +551,14 @@ private void scheduleRetry(String normalizedName) {
557551
}
558552
Optional<ServerConnection> serverOpt = playerOpt.get().getCurrentServer();
559553
if (serverOpt.isEmpty()) {
554+
logger.debug("Auto-login retry for {} deferred: no active server connection yet", normalizedName);
555+
scheduleRetry(normalizedName);
556+
return;
557+
}
558+
int current = attempts.getAndIncrement();
559+
if (current >= MAX_RETRIES) {
560560
pendingAutoLogins.remove(normalizedName);
561-
logger.debug("Auto-login retry cancelled for {} (player has no active server)", normalizedName);
561+
logger.warn("No auto-login ACK received for {} after {} retries; giving up", normalizedName, MAX_RETRIES);
562562
return;
563563
}
564564
String serverName = serverOpt.get().getServer().getServerInfo().getName();

0 commit comments

Comments
 (0)