mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FEATURE] Настройка Netty
This commit is contained in:
parent
748b9ac4e7
commit
e2c7b455d2
5 changed files with 16 additions and 1 deletions
|
@ -86,6 +86,7 @@ public static final class Config {
|
||||||
public int threadCoreCount;
|
public int threadCoreCount;
|
||||||
|
|
||||||
public ExeConf launch4j;
|
public ExeConf launch4j;
|
||||||
|
public NettyConfig netty;
|
||||||
|
|
||||||
public boolean compress;
|
public boolean compress;
|
||||||
|
|
||||||
|
@ -178,6 +179,11 @@ public static class ExeConf {
|
||||||
public String txtFileVersion;
|
public String txtFileVersion;
|
||||||
public String txtProductVersion;
|
public String txtProductVersion;
|
||||||
}
|
}
|
||||||
|
public class NettyConfig
|
||||||
|
{
|
||||||
|
public String bindAddress;
|
||||||
|
public int port;
|
||||||
|
}
|
||||||
|
|
||||||
private final class ProfilesFileVisitor extends SimpleFileVisitor<Path> {
|
private final class ProfilesFileVisitor extends SimpleFileVisitor<Path> {
|
||||||
private final Collection<ClientProfile> result;
|
private final Collection<ClientProfile> result;
|
||||||
|
|
|
@ -89,6 +89,12 @@ public void setPort(int port) {
|
||||||
body.append(";");
|
body.append(";");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setNettyPort(int port) {
|
||||||
|
body.append("this.nettyPort = ");
|
||||||
|
body.append(port);
|
||||||
|
body.append(";");
|
||||||
|
}
|
||||||
|
|
||||||
public void setEnv(LauncherConfig.LauncherEnvironment env) {
|
public void setEnv(LauncherConfig.LauncherEnvironment env) {
|
||||||
int i = 2;
|
int i = 2;
|
||||||
switch (env) {
|
switch (env) {
|
||||||
|
|
|
@ -130,6 +130,8 @@ public Path process(Path inputJar) throws IOException {
|
||||||
server.buildHookManager.hook(context);
|
server.buildHookManager.hook(context);
|
||||||
jaConfigurator.setAddress(server.config.getAddress());
|
jaConfigurator.setAddress(server.config.getAddress());
|
||||||
jaConfigurator.setPort(server.config.port);
|
jaConfigurator.setPort(server.config.port);
|
||||||
|
if(server.config.netty != null)
|
||||||
|
jaConfigurator.setNettyPort(server.config.netty.port);
|
||||||
jaConfigurator.setProjectName(server.config.projectName);
|
jaConfigurator.setProjectName(server.config.projectName);
|
||||||
jaConfigurator.setSecretKey(SecurityHelper.randomStringAESKey());
|
jaConfigurator.setSecretKey(SecurityHelper.randomStringAESKey());
|
||||||
jaConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512));
|
jaConfigurator.setClientPort(32148 + SecurityHelper.newRandom().nextInt(512));
|
||||||
|
|
|
@ -148,7 +148,7 @@ public void initChannel(NioSocketChannel ch) {
|
||||||
pipeline.addLast(new WebSocketFrameHandler());
|
pipeline.addLast(new WebSocketFrameHandler());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ChannelFuture f = b.bind(new InetSocketAddress(9876)).sync(); //TEST ONLY!
|
ChannelFuture f = b.bind(new InetSocketAddress(LaunchServer.server.config.netty.port)).sync(); //TEST ONLY!
|
||||||
f.channel().closeFuture().sync();
|
f.channel().closeFuture().sync();
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -4,6 +4,7 @@ public class AutogenConfig {
|
||||||
public String projectname;
|
public String projectname;
|
||||||
public String address;
|
public String address;
|
||||||
public int port;
|
public int port;
|
||||||
|
public int nettyPort;
|
||||||
public int clientPort;
|
public int clientPort;
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private boolean isInitModules;
|
private boolean isInitModules;
|
||||||
|
|
Loading…
Reference in a new issue