mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FIX] Закрытие соеденения при выходе
This commit is contained in:
parent
40d4003696
commit
8466894d49
2 changed files with 8 additions and 1 deletions
|
@ -139,7 +139,6 @@ public void run() {
|
||||||
public void initChannel(NioSocketChannel ch) {
|
public void initChannel(NioSocketChannel ch) {
|
||||||
ChannelPipeline pipeline = ch.pipeline();
|
ChannelPipeline pipeline = ch.pipeline();
|
||||||
//p.addLast(new LoggingHandler(LogLevel.INFO));
|
//p.addLast(new LoggingHandler(LogLevel.INFO));
|
||||||
System.out.println("P!");
|
|
||||||
pipeline.addLast(new HttpServerCodec());
|
pipeline.addLast(new HttpServerCodec());
|
||||||
pipeline.addLast(new HttpObjectAggregator(65536));
|
pipeline.addLast(new HttpObjectAggregator(65536));
|
||||||
pipeline.addLast(new WebSocketServerCompressionHandler());
|
pipeline.addLast(new WebSocketServerCompressionHandler());
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
import ru.gravit.launcher.events.request.ErrorRequestEvent;
|
import ru.gravit.launcher.events.request.ErrorRequestEvent;
|
||||||
import ru.gravit.launcher.request.RequestException;
|
import ru.gravit.launcher.request.RequestException;
|
||||||
import ru.gravit.launcher.request.ResultInterface;
|
import ru.gravit.launcher.request.ResultInterface;
|
||||||
|
import ru.gravit.utils.helper.JVMHelper;
|
||||||
import ru.gravit.utils.helper.LogHelper;
|
import ru.gravit.utils.helper.LogHelper;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -44,6 +45,13 @@ public static void initWebSockets(String address) {
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
JVMHelper.RUNTIME.addShutdownHook(new Thread(() -> {
|
||||||
|
try {
|
||||||
|
service.closeBlocking();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
LogHelper.error(e);
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
Loading…
Reference in a new issue