mirror of
https://github.com/PaperMC/Velocity.git
synced 2026-06-21 09:47:44 +02:00
Always close HttpClient (#1798)
* Always close HttpClient (even on exception) * Get rid of try/catch since we now use java 21
This commit is contained in:
@@ -268,14 +268,8 @@ public class InitialLoginSessionHandler implements MinecraftSessionHandler {
|
|||||||
inbound.disconnect(Component.translatable("multiplayer.disconnect.authservers_down"));
|
inbound.disconnect(Component.translatable("multiplayer.disconnect.authservers_down"));
|
||||||
}
|
}
|
||||||
}, mcConnection.eventLoop())
|
}, mcConnection.eventLoop())
|
||||||
.thenRun(() -> {
|
.whenComplete((ignored, throwable) -> {
|
||||||
try {
|
httpClient.close();
|
||||||
httpClient.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
// In Java 21, the HttpClient does not throw any Exception
|
|
||||||
// when trying to clean its resources, so this should not happen
|
|
||||||
logger.error("An unknown error occurred while trying to close an HttpClient", e);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
} catch (GeneralSecurityException e) {
|
} catch (GeneralSecurityException e) {
|
||||||
logger.error("Unable to enable encryption", e);
|
logger.error("Unable to enable encryption", e);
|
||||||
|
|||||||
Reference in New Issue
Block a user