From f4dcd996396ac5e20c10552eb411a4182c18b446 Mon Sep 17 00:00:00 2001 From: Zaxar163 Date: Wed, 18 Dec 2019 17:24:07 +0100 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=98=D0=B3=D0=BD=D0=BE=D1=80=D0=B8?= =?UTF-8?q?=D1=80=D1=83=D0=B5=D0=BC=20Overflow=20(=D0=B2=D0=BE=D0=B7=D0=BC?= =?UTF-8?q?=D0=BE=D0=B6=D0=B5=D0=BD=20=D0=BD=D0=B0=20=D1=82=D1=8F=D0=B6?= =?UTF-8?q?=D1=91=D0=BB=D1=8B=D1=85=20=D1=81=D0=B1=D0=BE=D1=80=D0=BA=D0=B0?= =?UTF-8?q?=D1=85).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/pro/gravit/launcher/ClientLauncherWrapper.java | 2 ++ .../java/pro/gravit/launcher/client/ClientLauncher.java | 1 + .../pro/gravit/launcher/client/ClientProcessBuilder.java | 2 ++ .../src/main/java/pro/gravit/launcher/utils/DirWatcher.java | 6 ++++-- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java b/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java index 6ea83190..6e3cf58b 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java +++ b/Launcher/src/main/java/pro/gravit/launcher/ClientLauncherWrapper.java @@ -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"); diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java index 2905bfd2..8a3fab23 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java @@ -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"); diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientProcessBuilder.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientProcessBuilder.java index c51b3938..0d579e7e 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientProcessBuilder.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientProcessBuilder.java @@ -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"); diff --git a/Launcher/src/main/java/pro/gravit/launcher/utils/DirWatcher.java b/Launcher/src/main/java/pro/gravit/launcher/utils/DirWatcher.java index ea0edbbf..a9590784 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/utils/DirWatcher.java +++ b/Launcher/src/main/java/pro/gravit/launcher/utils/DirWatcher.java @@ -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"); }