[FIX] Игнорируем Overflow (возможен на тяжёлых сборках).

This commit is contained in:
Zaxar163 2019-12-18 17:24:07 +01:00
parent 6f22ae3c7d
commit f4dcd99639
No known key found for this signature in database
GPG key ID: 1FE4F2E1F053831B
4 changed files with 9 additions and 2 deletions

View file

@ -3,6 +3,7 @@
import pro.gravit.launcher.client.ClientLauncher;
import pro.gravit.launcher.client.ClientModuleManager;
import pro.gravit.launcher.client.DirBridge;
import pro.gravit.launcher.utils.DirWatcher;
import pro.gravit.utils.helper.EnvHelper;
import pro.gravit.utils.helper.IOHelper;
import pro.gravit.utils.helper.JVMHelper;
@ -59,6 +60,7 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
JVMHelper.addSystemPropertyToArgs(args, DirBridge.CUSTOMDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(args, DirBridge.USE_CUSTOMDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(args, DirBridge.USE_OPTDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(args, DirWatcher.IGN_OVERFLOW);
if (!noJava9check && !System.getProperty("java.version").startsWith("1.8")) {
LogHelper.debug("Found Java 9+ ( %s )", System.getProperty("java.version"));
args.add("--add-modules");

View file

@ -351,6 +351,7 @@ public static Process launch(
JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.CUSTOMDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.USE_CUSTOMDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.USE_OPTDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(context.args, DirWatcher.IGN_OVERFLOW);
if (JVMHelper.OS_TYPE == OS.MUSTDIE) {
if (JVMHelper.OS_VERSION.startsWith("10.")) {
LogHelper.debug("MustDie 10 fix is applied");

View file

@ -5,6 +5,7 @@
import pro.gravit.launcher.hasher.HashedDir;
import pro.gravit.launcher.managers.ClientHookManager;
import pro.gravit.launcher.profiles.ClientProfile;
import pro.gravit.launcher.utils.DirWatcher;
import pro.gravit.utils.helper.EnvHelper;
import pro.gravit.utils.helper.IOHelper;
import pro.gravit.utils.helper.JVMHelper;
@ -99,6 +100,7 @@ public ClientLauncherContext build() throws IOException {
JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.CUSTOMDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.USE_CUSTOMDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(context.args, DirBridge.USE_OPTDIR_PROPERTY);
JVMHelper.addSystemPropertyToArgs(context.args, DirWatcher.IGN_OVERFLOW);
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
if (JVMHelper.OS_VERSION.startsWith("10.")) {
LogHelper.debug("MustDie 10 fix is applied");

View file

@ -46,6 +46,9 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) th
StandardWatchEventKinds.ENTRY_CREATE, StandardWatchEventKinds.ENTRY_MODIFY, StandardWatchEventKinds.ENTRY_DELETE
};
public static final String IGN_OVERFLOW = "launcher.dirwatcher.ignoreOverflows";
private static final boolean PROP_IGN_OVERFLOW = Boolean.getBoolean(IGN_OVERFLOW);
private static void handleError(Throwable e) {
LogHelper.error(e);
NativeJVMHalt.haltA(-123);
@ -82,7 +85,6 @@ public DirWatcher(Path dir, HashedDir hdir, FileNameMatcher matcher, boolean dig
}
@Override
public void close() throws IOException {
service.close();
}
@ -92,7 +94,7 @@ private void processKey(WatchKey key) throws IOException {
for (WatchEvent<?> event : key.pollEvents()) {
Kind<?> kind = event.kind();
if (kind.equals(StandardWatchEventKinds.OVERFLOW)) {
if (Boolean.getBoolean("launcher.dirwatcher.ignoreOverflows"))
if (PROP_IGN_OVERFLOW)
continue; // Sometimes it's better to ignore than interrupt fair playing
throw new IOException("Overflow");
}