mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-01-08 09:17:43 +01:00
Make webserver resource-closing more watertight against potential leaks
This commit is contained in:
parent
155f56e62a
commit
7156993323
@ -120,7 +120,26 @@ public void accept(SelectionKey selectionKey) {
|
||||
|
||||
private void handleIOException(Channel channel, IOException e) {
|
||||
request.clear();
|
||||
response = null;
|
||||
|
||||
if (response != null) {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e2) {
|
||||
Logger.global.logWarning("Failed to close response: " + e2);
|
||||
}
|
||||
response = null;
|
||||
}
|
||||
|
||||
if (futureResponse != null) {
|
||||
futureResponse.thenAccept(response -> {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e2) {
|
||||
Logger.global.logWarning("Failed to close response: " + e2);
|
||||
}
|
||||
});
|
||||
futureResponse = null;
|
||||
}
|
||||
|
||||
Logger.global.logDebug("Failed to process selection: " + e);
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user