From 99cc92eb8b90d74928d8935d9d7b185deeabcaf5 Mon Sep 17 00:00:00 2001 From: crschnick Date: Sun, 20 Aug 2023 21:44:55 +0000 Subject: [PATCH] Rework connection timeouts --- app/src/main/java/io/xpipe/app/prefs/AppPrefs.java | 13 +++++++++++++ .../app/resources/lang/preferences_en.properties | 3 +++ .../java/io/xpipe/core/process/ShellControl.java | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java b/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java index 8e7fbd0e..6b05f095 100644 --- a/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java +++ b/app/src/main/java/io/xpipe/app/prefs/AppPrefs.java @@ -104,6 +104,11 @@ public class AppPrefs { private final BooleanProperty useSystemFontInternal = typed(new SimpleBooleanProperty(true), Boolean.class); public final ReadOnlyBooleanProperty useSystemFont = useSystemFontInternal; private final IntegerProperty tooltipDelayInternal = typed(new SimpleIntegerProperty(1000), Integer.class); + private final IntegerProperty connectionTimeOut = typed(new SimpleIntegerProperty(10), Integer.class); + + public ReadOnlyIntegerProperty connectionTimeout() { + return connectionTimeOut; + } private final BooleanProperty saveWindowLocationInternal = typed(new SimpleBooleanProperty(false), Boolean.class); public final ReadOnlyBooleanProperty saveWindowLocation = saveWindowLocationInternal; @@ -614,6 +619,14 @@ public class AppPrefs { Setting.of("tooltipDelay", tooltipDelayInternal, tooltipDelayMin, tooltipDelayMax), Setting.of("language", languageControl, languageInternal)), Group.of("windowOptions", Setting.of("saveWindowLocation", saveWindowLocationInternal))), + Category.of( + "connections", + Group.of( + Setting.of( + "connectionTimeout", + connectionTimeOut, + 5, + 50))), new PasswordCategory(this).create(), Category.of( "editor", diff --git a/app/src/main/resources/io/xpipe/app/resources/lang/preferences_en.properties b/app/src/main/resources/io/xpipe/app/resources/lang/preferences_en.properties index a2d4dce9..94c68f72 100644 --- a/app/src/main/resources/io/xpipe/app/resources/lang/preferences_en.properties +++ b/app/src/main/resources/io/xpipe/app/resources/lang/preferences_en.properties @@ -1,3 +1,6 @@ +connectionTimeout=Connection timeout +connectionTimeoutDescription=The time in seconds to wait for a response before considering a connection to be timed out. If some of your remote systems take long to connect, you can try to increase this value. +connections=Connections appearance=Appearance integrations=Integrations uiOptions=UI Options diff --git a/core/src/main/java/io/xpipe/core/process/ShellControl.java b/core/src/main/java/io/xpipe/core/process/ShellControl.java index 8edfabb3..e66a630d 100644 --- a/core/src/main/java/io/xpipe/core/process/ShellControl.java +++ b/core/src/main/java/io/xpipe/core/process/ShellControl.java @@ -111,7 +111,7 @@ public interface ShellControl extends ProcessControl { ShellControl initWith(List cmds); - ShellControl startTimeout(int ms); + ShellControl additionalTimeout(int ms); FailableSupplier getElevationPassword();