Go back to normal thread for now using MSA auth, and only toggle leak detector on standalone

This commit is contained in:
Redned 2021-07-18 17:41:47 -05:00 committed by RednedEpic
parent ae4e4397e3
commit 39324ce95d
2 changed files with 5 additions and 8 deletions

View file

@ -126,7 +126,7 @@ public class GeyserConnector {
private Metrics metrics; private Metrics metrics;
private GeyserConnector(PlatformType platformType, GeyserBootstrap bootstrap) { private GeyserConnector(PlatformType platformType, GeyserBootstrap bootstrap) {
if (System.getProperty("io.netty.leakDetection.level") == null) { if (platformType == PlatformType.STANDALONE && System.getProperty("io.netty.leakDetection.level") == null) {
ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED); // Can eat performance ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.DISABLED); // Can eat performance
} }

View file

@ -609,10 +609,8 @@ public class GeyserSession implements CommandSender {
} }
loggingIn = true; loggingIn = true;
// new thread so clients don't timeout
// Use a future to prevent timeouts as all the authentication is handled sync new Thread(() -> {
// This will be changed with the new protocol library.
CompletableFuture.supplyAsync(() -> {
try { try {
MsaAuthenticationService msaAuthenticationService = new MsaAuthenticationService(GeyserConnector.OAUTH_CLIENT_ID); MsaAuthenticationService msaAuthenticationService = new MsaAuthenticationService(GeyserConnector.OAUTH_CLIENT_ID);
@ -632,8 +630,7 @@ public class GeyserSession implements CommandSender {
} catch (RequestException ex) { } catch (RequestException ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
return null; }).start();
}).whenComplete((aVoid, ex) -> connectDownstream());
} }
/** /**
@ -650,7 +647,7 @@ public class GeyserSession implements CommandSender {
connectDownstream(); connectDownstream();
} catch (RequestException e) { } catch (RequestException e) {
if (!(e instanceof AuthPendingException)) { if (!(e instanceof AuthPendingException)) {
e.printStackTrace(); throw new RuntimeException("Failed to log in with Microsoft code!", e);
} else { } else {
// Wait one second before trying again // Wait one second before trying again
connector.getGeneralThreadPool().schedule(() -> attemptCodeAuthentication(msaAuthenticationService), 1, TimeUnit.SECONDS); connector.getGeneralThreadPool().schedule(() -> attemptCodeAuthentication(msaAuthenticationService), 1, TimeUnit.SECONDS);