[FIX] Дупликаты кода в ClientLauncher, названия хандлеров в LauncherNettyServer

This commit is contained in:
zaxar163 2019-09-29 09:26:04 +03:00
parent 50d5c941f4
commit a38853180b
3 changed files with 11 additions and 19 deletions

View file

@ -56,15 +56,15 @@ public void initChannel(SocketChannel ch) {
ChannelPipeline pipeline = ch.pipeline();
NettyConnectContext context = new NettyConnectContext();
//p.addLast(new LoggingHandler(LogLevel.INFO));
pipeline.addLast("httpc", new HttpServerCodec());
pipeline.addLast("httpca",new HttpObjectAggregator(65536));
pipeline.addLast("http-codec", new HttpServerCodec());
pipeline.addLast("http-codec-compressor",new HttpObjectAggregator(65536));
if (server.config.netty.ipForwarding)
pipeline.addLast("forward", new NettyIpForwardHandler(context));
pipeline.addLast("decomp", new WebSocketServerCompressionHandler());
pipeline.addLast("decoder", new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true));
pipeline.addLast("forward-http", new NettyIpForwardHandler(context));
pipeline.addLast("websock-comp", new WebSocketServerCompressionHandler());
pipeline.addLast("websock-codec", new WebSocketServerProtocolHandler(WEBSOCKET_PATH, null, true));
if (server.config.netty.fileServerEnabled)
pipeline.addLast(new FileServerHandler(server.updatesDir, true, config.showHiddenFiles));
pipeline.addLast("final", new WebSocketFrameHandler(context, server, service));
pipeline.addLast("fileserver", new FileServerHandler(server.updatesDir, true, config.showHiddenFiles));
pipeline.addLast("launchserver", new WebSocketFrameHandler(context, server, service));
pipelineHook.hook(context, ch);
}
});

View file

@ -595,15 +595,11 @@ public static interface ParamsAPI {
public static ParamsAPI container = new ParamsAPI() {
@Override
public ParamContainer read() throws Exception {
ParamContainer p = new ParamContainer();
ParamContainer p;
try (Socket socket = IOHelper.newSocket()) {
socket.connect(new InetSocketAddress(SOCKET_HOST, SOCKET_PORT));
try (HInput input = new HInput(socket.getInputStream())) {
p.params = new Params(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);
p = new ParamContainer(input);
}
}
return p;
@ -630,11 +626,7 @@ public void write(ParamContainer p) throws Exception {
return;
}
try (HOutput output = new HOutput(client.getOutputStream())) {
p.params.write(output);
output.writeString(Launcher.gsonManager.gson.toJson(p.profile), 0);
p.assetHDir.write(output);
p.clientHDir.write(output);
ClientHookManager.paramsOutputHook.hook(output);
p.write(output);
}
clientStarted = true;
}

@ -1 +1 @@
Subproject commit 3e485e5ae681cd1c136fc25a49d5dd339bc4d30a
Subproject commit 3bc733e724483b064000371fb26bb31c60aa5308