From 0e215899e4dce9a74bd6bf5ac8ba55ab3a600f74 Mon Sep 17 00:00:00 2001 From: Gravit Date: Tue, 29 Jan 2019 22:42:31 +0700 Subject: [PATCH] =?UTF-8?q?[FEATURE]=20=D0=90=D0=B2=D1=82=D0=BE=D0=B7?= =?UTF-8?q?=D0=B0=D0=BF=D1=83=D1=81=D0=BA=20netty=20=D1=81=D0=B5=D1=80?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D0=B0=20=D0=BF=D1=80=D0=B8=20=D0=B5=D0=B3?= =?UTF-8?q?=D0=BE=20=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/ru/gravit/launchserver/LaunchServer.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java index 8e0be32d..54770fe5 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/LaunchServer.java @@ -27,6 +27,7 @@ import ru.gravit.launchserver.manangers.hook.BuildHookManager; import ru.gravit.launchserver.manangers.hook.SocketHookManager; import ru.gravit.launchserver.response.Response; +import ru.gravit.launchserver.socket.NettyServerSocketHandler; import ru.gravit.launchserver.socket.ServerSocketHandler; import ru.gravit.launchserver.texture.RequestTextureProvider; import ru.gravit.launchserver.texture.TextureProvider; @@ -289,6 +290,8 @@ public static void main(String... args) throws Throwable { public final ServerSocketHandler serverSocketHandler; + public final NettyServerSocketHandler nettyServerSocketHandler; + private final AtomicBoolean started = new AtomicBoolean(false); // Updates and profiles @@ -450,6 +453,10 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE modulesManager.postInitModules(); // start updater this.updater = new Updater(this); + if(config.netty != null) + nettyServerSocketHandler = new NettyServerSocketHandler(this); + else + nettyServerSocketHandler = null; } public static void initGson() { @@ -587,6 +594,11 @@ public void rebindServerSocket() { CommonHelper.newThread("Server Socket Thread", false, serverSocketHandler).start(); } + public void rebindNettyServerSocket() { + nettyServerSocketHandler.close(); + CommonHelper.newThread("Netty Server Socket Thread", false, nettyServerSocketHandler).start(); + } + @Override public void run() { if (started.getAndSet(true)) @@ -596,6 +608,8 @@ public void run() { JVMHelper.RUNTIME.addShutdownHook(CommonHelper.newThread(null, false, this::close)); CommonHelper.newThread("Command Thread", true, commandHandler).start(); rebindServerSocket(); + if(config.netty != null) + rebindNettyServerSocket(); modulesManager.finishModules(); }