Timeout fixes [stage]

This commit is contained in:
crschnick 2023-12-01 00:28:05 +00:00
parent d5b3d1ac65
commit e3265a573d
3 changed files with 11 additions and 4 deletions

View file

@ -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<Integer> {
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

View file

@ -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));

View file

@ -1 +1 @@
1.7.9-2
1.7.9-3