mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] Дупликаты кода в ClientLauncher, названия хандлеров в LauncherNettyServer
This commit is contained in:
parent
50d5c941f4
commit
a38853180b
3 changed files with 11 additions and 19 deletions
|
@ -56,15 +56,15 @@ public void initChannel(SocketChannel ch) {
|
||||||
ChannelPipeline pipeline = ch.pipeline();
|
ChannelPipeline pipeline = ch.pipeline();
|
||||||
NettyConnectContext context = new NettyConnectContext();
|
NettyConnectContext context = new NettyConnectContext();
|
||||||
//p.addLast(new LoggingHandler(LogLevel.INFO));
|
//p.addLast(new LoggingHandler(LogLevel.INFO));
|
||||||
pipeline.addLast("httpc", new HttpServerCodec());
|
pipeline.addLast("http-codec", new HttpServerCodec());
|
||||||
pipeline.addLast("httpca",new HttpObjectAggregator(65536));
|
pipeline.addLast("http-codec-compressor",new HttpObjectAggregator(65536));
|
||||||
if (server.config.netty.ipForwarding)
|
if (server.config.netty.ipForwarding)
|
||||||
pipeline.addLast("forward", new NettyIpForwardHandler(context));
|
pipeline.addLast("forward-http", new NettyIpForwardHandler(context));
|
||||||
pipeline.addLast("decomp", new WebSocketServerCompressionHandler());
|
pipeline.addLast("websock-comp", new WebSocketServerCompressionHandler());
|
||||||
pipeline.addLast("decoder", new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true));
|
pipeline.addLast("websock-codec", new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true));
|
||||||
if (server.config.netty.fileServerEnabled)
|
if (server.config.netty.fileServerEnabled)
|
||||||
pipeline.addLast(new FileServerHandler(server.updatesDir, true, config.showHiddenFiles));
|
pipeline.addLast("fileserver", new FileServerHandler(server.updatesDir, true, config.showHiddenFiles));
|
||||||
pipeline.addLast("final", new WebSocketFrameHandler(context, server, service));
|
pipeline.addLast("launchserver", new WebSocketFrameHandler(context, server, service));
|
||||||
pipelineHook.hook(context, ch);
|
pipelineHook.hook(context, ch);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -595,15 +595,11 @@ public static interface ParamsAPI {
|
||||||
public static ParamsAPI container = new ParamsAPI() {
|
public static ParamsAPI container = new ParamsAPI() {
|
||||||
@Override
|
@Override
|
||||||
public ParamContainer read() throws Exception {
|
public ParamContainer read() throws Exception {
|
||||||
ParamContainer p = new ParamContainer();
|
ParamContainer p;
|
||||||
try (Socket socket = IOHelper.newSocket()) {
|
try (Socket socket = IOHelper.newSocket()) {
|
||||||
socket.connect(new InetSocketAddress(SOCKET_HOST, SOCKET_PORT));
|
socket.connect(new InetSocketAddress(SOCKET_HOST, SOCKET_PORT));
|
||||||
try (HInput input = new HInput(socket.getInputStream())) {
|
try (HInput input = new HInput(socket.getInputStream())) {
|
||||||
p.params = new Params(input);
|
p = new ParamContainer(input);
|
||||||
p.profile = Launcher.gsonManager.gson.fromJson(input.readString(0), ClientProfile.class);
|
|
||||||
p.assetHDir = new HashedDir(input);
|
|
||||||
p.clientHDir = new HashedDir(input);
|
|
||||||
ClientHookManager.paramsInputHook.hook(input);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
|
@ -630,11 +626,7 @@ public void write(ParamContainer p) throws Exception {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try (HOutput output = new HOutput(client.getOutputStream())) {
|
try (HOutput output = new HOutput(client.getOutputStream())) {
|
||||||
p.params.write(output);
|
p.write(output);
|
||||||
output.writeString(Launcher.gsonManager.gson.toJson(p.profile), 0);
|
|
||||||
p.assetHDir.write(output);
|
|
||||||
p.clientHDir.write(output);
|
|
||||||
ClientHookManager.paramsOutputHook.hook(output);
|
|
||||||
}
|
}
|
||||||
clientStarted = true;
|
clientStarted = true;
|
||||||
}
|
}
|
||||||
|
|
2
modules
2
modules
|
@ -1 +1 @@
|
||||||
Subproject commit 3e485e5ae681cd1c136fc25a49d5dd339bc4d30a
|
Subproject commit 3bc733e724483b064000371fb26bb31c60aa5308
|
Loading…
Reference in a new issue