Полностью отключены СlientParams*.bin

This commit is contained in:
Gravit 2018-10-08 21:10:41 +07:00
parent 5fc4b01b8a
commit 1115935a3a

View file

@ -293,31 +293,25 @@ public static Process launch(
SignedObjectHolder<ClientProfile> profile, Params params, boolean pipeOutput) throws Throwable { SignedObjectHolder<ClientProfile> profile, Params params, boolean pipeOutput) throws Throwable {
// Write params file (instead of CLI; Mustdie32 API can't handle command line > 32767 chars) // Write params file (instead of CLI; Mustdie32 API can't handle command line > 32767 chars)
LogHelper.debug("Writing ClientLauncher params"); LogHelper.debug("Writing ClientLauncher params");
Path paramsFile = Files.createTempFile("ClientLauncherParams", ".bin");
CommonHelper.newThread("Client params writter", false, () -> CommonHelper.newThread("Client params writter", false, () ->
{ {
try { try {
try (ServerSocket socket = new ServerSocket()) { try (ServerSocket socket = new ServerSocket()) {
socket.setReuseAddress(true);
socket.bind(new InetSocketAddress(SOCKET_HOST, SOCKET_PORT)); socket.setReuseAddress(true);
Socket client = socket.accept(); socket.bind(new InetSocketAddress(SOCKET_HOST, SOCKET_PORT));
try (HOutput output = new HOutput(client.getOutputStream())) { Socket client = socket.accept();
params.write(output); try (HOutput output = new HOutput(client.getOutputStream())) {
profile.write(output); params.write(output);
assetHDir.write(output); profile.write(output);
clientHDir.write(output); assetHDir.write(output);
} clientHDir.write(output);
}
} }
} catch (Exception e) { } catch (IOException e) {
LogHelper.error(e); LogHelper.error(e);
try (HOutput output = new HOutput(IOHelper.newOutput(paramsFile))) {
params.write(output);
profile.write(output);
assetHDir.write(output);
clientHDir.write(output);
} catch (IOException e1) {
LogHelper.error(e1);
}
} }
}).start(); }).start();
// Resolve java bin and set permissions // Resolve java bin and set permissions
@ -362,7 +356,6 @@ public static Process launch(
//if(wrapper) //if(wrapper)
//Collections.addAll(args, "-Djava.class.path=".concat(classPathString.toString())); // Add Class Path //Collections.addAll(args, "-Djava.class.path=".concat(classPathString.toString())); // Add Class Path
Collections.addAll(args, ClientLauncher.class.getName()); Collections.addAll(args, ClientLauncher.class.getName());
Collections.addAll(args, paramsFile.toString());
// Print commandline debug message // Print commandline debug message
LogHelper.debug("Commandline: " + args); LogHelper.debug("Commandline: " + args);
@ -397,9 +390,6 @@ public static void main(String... args) throws Throwable {
checkJVMBitsAndVersion(); checkJVMBitsAndVersion();
JVMHelper.verifySystemProperties(ClientLauncher.class, true); JVMHelper.verifySystemProperties(ClientLauncher.class, true);
LogHelper.printVersion("Client Launcher"); LogHelper.printVersion("Client Launcher");
// Resolve params file
VerifyHelper.verifyInt(args.length, l -> l >= 1, "Missing args: <paramsFile>");
Path paramsFile = IOHelper.toPath(args[0]);
// Read and delete params file // Read and delete params file
LogHelper.debug("Reading ClientLauncher params"); LogHelper.debug("Reading ClientLauncher params");
Params params; Params params;
@ -420,16 +410,8 @@ public static void main(String... args) throws Throwable {
} }
} catch (IOException ex) { } catch (IOException ex) {
LogHelper.error(ex); LogHelper.error(ex);
try (HInput input = new HInput(IOHelper.newInput(paramsFile))) { System.exit(-98);
params = new Params(input); return;
profile = new SignedObjectHolder<>(input, publicKey, ClientProfile.RO_ADAPTER);
// Read hdirs
assetHDir = new SignedObjectHolder<>(input, publicKey, HashedDir::new);
clientHDir = new SignedObjectHolder<>(input, publicKey, HashedDir::new);
} finally {
Files.delete(paramsFile);
}
} }
Launcher.profile = profile.object; Launcher.profile = profile.object;
Launcher.modulesManager.initModules(); Launcher.modulesManager.initModules();