From e3265a573dc9bef657b9c9b990b2aec5ae2355f2 Mon Sep 17 00:00:00 2001 From: crschnick Date: Fri, 1 Dec 2023 00:28:05 +0000 Subject: [PATCH] Timeout fixes [stage] --- .../main/java/io/xpipe/app/launcher/LauncherCommand.java | 4 +++- beacon/src/main/java/io/xpipe/beacon/BeaconClient.java | 9 +++++++-- version | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java b/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java index e9b5f1ccf..e020c97ec 100644 --- a/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java +++ b/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java @@ -13,6 +13,7 @@ import io.xpipe.beacon.exchange.FocusExchange; import io.xpipe.beacon.exchange.OpenExchange; import io.xpipe.core.process.OsType; import io.xpipe.core.util.XPipeDaemonMode; +import io.xpipe.core.util.XPipeInstallation; import lombok.SneakyThrows; import picocli.CommandLine; @@ -87,8 +88,9 @@ public class LauncherCommand implements Callable { OperationMode.halt(1); } } catch (Exception ex) { + var cli = XPipeInstallation.getLocalDefaultCliExecutable(); ErrorEvent.fromThrowable(ex).description("Unable to connect to existing running daemon instance as it did not respond." + - " Either try to kill the process xpiped manually or use the command xpipe daemon stop --force if the CLI is in your path.").handle(); + " Either try to kill the process xpiped manually or use the command " + cli + " daemon stop --force.").handle(); } // Even in case we are unable to reach another beacon server diff --git a/beacon/src/main/java/io/xpipe/beacon/BeaconClient.java b/beacon/src/main/java/io/xpipe/beacon/BeaconClient.java index 71cc68329..2e8a16282 100644 --- a/beacon/src/main/java/io/xpipe/beacon/BeaconClient.java +++ b/beacon/src/main/java/io/xpipe/beacon/BeaconClient.java @@ -21,8 +21,12 @@ import lombok.Getter; import lombok.Value; import lombok.extern.jackson.Jacksonized; -import java.io.*; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.StringWriter; import java.net.InetAddress; +import java.net.InetSocketAddress; import java.net.Socket; import java.nio.charset.StandardCharsets; import java.util.Arrays; @@ -45,7 +49,8 @@ public class BeaconClient implements AutoCloseable { } public static BeaconClient connect(ClientInformation information) throws Exception { - var socket = new Socket(InetAddress.getLoopbackAddress(), BeaconConfig.getUsedPort()); + var socket = new Socket(); + socket.connect(new InetSocketAddress(InetAddress.getLoopbackAddress(), BeaconConfig.getUsedPort()), 5000); socket.setSoTimeout(5000); var client = new BeaconClient(socket, socket.getInputStream(), socket.getOutputStream()); client.sendObject(JacksonMapper.getDefault().valueToTree(information)); diff --git a/version b/version index a87ef26ab..e2cb4ecbe 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.7.9-2 \ No newline at end of file +1.7.9-3 \ No newline at end of file