[FEATURE] Удален неиспользуемый и неактуальный код: launchLocal и address_override

This commit is contained in:
Gravit 2019-03-12 15:32:14 +07:00
parent 88be2a623b
commit 367993daf0
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
4 changed files with 1 additions and 57 deletions

View file

@ -350,8 +350,6 @@ public static Process launch(
JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.CUSTOMDIR_PROPERTY); JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.CUSTOMDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.USE_CUSTOMDIR_PROPERTY); JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.USE_CUSTOMDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.USE_OPTDIR_PROPERTY); JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.USE_OPTDIR_PROPERTY);
if (LauncherConfig.ADDRESS_OVERRIDE != null)
context.args.add(JVMHelper.jvmProperty(LauncherConfig.ADDRESS_OVERRIDE_PROPERTY, LauncherConfig.ADDRESS_OVERRIDE));
if (JVMHelper.OS_TYPE == OS.MUSTDIE) { if (JVMHelper.OS_TYPE == OS.MUSTDIE) {
if (JVMHelper.OS_VERSION.startsWith("10.")) { if (JVMHelper.OS_VERSION.startsWith("10.")) {
LogHelper.debug("MustDie 10 fix is applied"); LogHelper.debug("MustDie 10 fix is applied");
@ -477,46 +475,6 @@ public static void main(String... args) throws Throwable {
} }
} }
@LauncherAPI
public void launchLocal(HashedDir assetHDir, HashedDir clientHDir,
ClientProfile profile, Params params) throws Throwable {
RSAPublicKey publicKey = Launcher.getConfig().publicKey;
LogHelper.debug("Verifying ClientLauncher sign and classpath");
SecurityHelper.verifySign(LegacyLauncherRequest.BINARY_PATH, params.launcherDigest, publicKey);
LinkedList<Path> classPath = resolveClassPathList(params.clientDir, profile.getClassPath());
for (Path classpathURL : classPath) {
LauncherAgent.addJVMClassPath(classpathURL.toAbsolutePath().toString());
}
URL[] classpathurls = resolveClassPath(params.clientDir, profile.getClassPath());
classLoader = new PublicURLClassLoader(classpathurls, ClassLoader.getSystemClassLoader());
Thread.currentThread().setContextClassLoader(classLoader);
classLoader.nativePath = params.clientDir.resolve(NATIVES_DIR).toString();
PublicURLClassLoader.systemclassloader = classLoader;
// Start client with WatchService monitoring
boolean digest = !profile.isUpdateFastCheck();
LogHelper.debug("Starting JVM and client WatchService");
FileNameMatcher assetMatcher = profile.getAssetUpdateMatcher();
FileNameMatcher clientMatcher = profile.getClientUpdateMatcher();
try (DirWatcher assetWatcher = new DirWatcher(params.assetDir, assetHDir, assetMatcher, digest);
DirWatcher clientWatcher = new DirWatcher(params.clientDir, clientHDir, clientMatcher, digest)) {
// Verify current state of all dirs
//verifyHDir(IOHelper.JVM_DIR, jvmHDir.object, null, digest);
HashedDir hdir = clientHDir;
//for (OptionalFile s : Launcher.profile.getOptional()) {
// if (params.updateOptional.contains(s)) s.mark = true;
// else hdir.removeR(s.file);
//}
Launcher.profile.pushOptionalFile(hdir,false);
verifyHDir(params.assetDir, assetHDir, assetMatcher, digest);
verifyHDir(params.clientDir, hdir, clientMatcher, digest);
Launcher.modulesManager.postInitModules();
// Start WatchService, and only then client
CommonHelper.newThread("Asset Directory Watcher", true, assetWatcher).start();
CommonHelper.newThread("Client Directory Watcher", true, clientWatcher).start();
launch(profile, params);
}
}
private static URL[] resolveClassPath(Path clientDir, String... classPath) throws IOException { private static URL[] resolveClassPath(Path clientDir, String... classPath) throws IOException {
Collection<Path> result = new LinkedList<>(); Collection<Path> result = new LinkedList<>();
for (String classPathEntry : classPath) { for (String classPathEntry : classPath) {

View file

@ -41,8 +41,6 @@ public static void update(LauncherConfig config, LauncherRequestEvent result) th
args.add(IOHelper.resolveJavaBin(null).toString()); args.add(IOHelper.resolveJavaBin(null).toString());
if (LogHelper.isDebugEnabled()) if (LogHelper.isDebugEnabled())
args.add(JVMHelper.jvmProperty(LogHelper.DEBUG_PROPERTY, Boolean.toString(LogHelper.isDebugEnabled()))); args.add(JVMHelper.jvmProperty(LogHelper.DEBUG_PROPERTY, Boolean.toString(LogHelper.isDebugEnabled())));
if (LauncherConfig.ADDRESS_OVERRIDE != null)
args.add(JVMHelper.jvmProperty(LauncherConfig.ADDRESS_OVERRIDE_PROPERTY, LauncherConfig.ADDRESS_OVERRIDE));
args.add("-jar"); args.add("-jar");
args.add(BINARY_PATH.toString()); args.add(BINARY_PATH.toString());
ProcessBuilder builder = new ProcessBuilder(args.toArray(new String[0])); ProcessBuilder builder = new ProcessBuilder(args.toArray(new String[0]));

View file

@ -61,8 +61,6 @@ public static void update(LauncherConfig config, Result result) throws Signature
args.add(IOHelper.resolveJavaBin(null).toString()); args.add(IOHelper.resolveJavaBin(null).toString());
if (LogHelper.isDebugEnabled()) if (LogHelper.isDebugEnabled())
args.add(JVMHelper.jvmProperty(LogHelper.DEBUG_PROPERTY, Boolean.toString(LogHelper.isDebugEnabled()))); args.add(JVMHelper.jvmProperty(LogHelper.DEBUG_PROPERTY, Boolean.toString(LogHelper.isDebugEnabled())));
if (LauncherConfig.ADDRESS_OVERRIDE != null)
args.add(JVMHelper.jvmProperty(LauncherConfig.ADDRESS_OVERRIDE_PROPERTY, LauncherConfig.ADDRESS_OVERRIDE));
args.add("-jar"); args.add("-jar");
args.add(BINARY_PATH.toString()); args.add(BINARY_PATH.toString());
ProcessBuilder builder = new ProcessBuilder(args.toArray(new String[0])); ProcessBuilder builder = new ProcessBuilder(args.toArray(new String[0]));

View file

@ -14,10 +14,6 @@
import java.util.*; import java.util.*;
public final class LauncherConfig extends StreamObject { public final class LauncherConfig extends StreamObject {
@LauncherAPI
public static final String ADDRESS_OVERRIDE_PROPERTY = "launcher.addressOverride";
@LauncherAPI
public static final String ADDRESS_OVERRIDE = System.getProperty(ADDRESS_OVERRIDE_PROPERTY, null);
private static final AutogenConfig config = new AutogenConfig(); private static final AutogenConfig config = new AutogenConfig();
@ -51,9 +47,7 @@ public static AutogenConfig getAutogenConfig() {
@LauncherAPI @LauncherAPI
public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException { public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException {
String localAddress = config.address; address = InetSocketAddress.createUnresolved( config.address, config.port);
address = InetSocketAddress.createUnresolved(
ADDRESS_OVERRIDE == null ? localAddress : ADDRESS_OVERRIDE, config.port);
publicKey = SecurityHelper.toPublicRSAKey(input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH)); publicKey = SecurityHelper.toPublicRSAKey(input.readByteArray(SecurityHelper.CRYPTO_MAX_LENGTH));
projectname = config.projectname; projectname = config.projectname;
clientPort = config.clientPort; clientPort = config.clientPort;
@ -84,10 +78,6 @@ public LauncherConfig(HInput input) throws IOException, InvalidKeySpecException
String.format("Duplicate runtime resource: '%s'", name)); String.format("Duplicate runtime resource: '%s'", name));
} }
runtime = Collections.unmodifiableMap(localResources); runtime = Collections.unmodifiableMap(localResources);
// Print warning if address override is enabled
if (ADDRESS_OVERRIDE != null)
LogHelper.warning("Address override is enabled: '%s'", ADDRESS_OVERRIDE);
} }
@LauncherAPI @LauncherAPI