From bae4906879c0f1c22d6923aa2141c1f47a302b43 Mon Sep 17 00:00:00 2001 From: Tim203 Date: Sat, 12 Jun 2021 14:20:30 +0200 Subject: [PATCH] Don't always automatically restart the skin uploader --- .../connector/skin/FloodgateSkinUploader.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java b/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java index 1849d4812..8c07cccbc 100644 --- a/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java +++ b/connector/src/main/java/org/geysermc/connector/skin/FloodgateSkinUploader.java @@ -56,6 +56,7 @@ public final class FloodgateSkinUploader { private final GeyserLogger logger; private final WebSocketClient client; + private volatile boolean closed; @Getter private int id; @Getter private String verifyCode; @@ -218,6 +219,12 @@ public final class FloodgateSkinUploader { } private void reconnectLater(GeyserConnector connector) { + // we ca only reconnect when the thread pool is open + if (connector.getGeneralThreadPool().isShutdown() || closed) { + logger.info("The skin uploader has been closed"); + return; + } + long additionalTime = ThreadLocalRandom.current().nextInt(7); // we don't have to check the result. onClose will handle that for us connector.getGeneralThreadPool() @@ -230,6 +237,9 @@ public final class FloodgateSkinUploader { } public void close() { - client.close(); + if (!closed) { + closed = true; + client.close(); + } } }