From 35796b8f27d1d5e8e5fad7ef30029c3c7eca5591 Mon Sep 17 00:00:00 2001 From: tobias <thinkdifferent055@gmail.com> Date: Sun, 12 Sep 2021 19:35:58 +0200 Subject: [PATCH] Set timeout to 5sec for server websocket connection --- .../src/main/java/de/tobias/playpad/server/ServerImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PlayWall/src/main/java/de/tobias/playpad/server/ServerImpl.java b/PlayWall/src/main/java/de/tobias/playpad/server/ServerImpl.java index 7920226a..ca60c2c7 100644 --- a/PlayWall/src/main/java/de/tobias/playpad/server/ServerImpl.java +++ b/PlayWall/src/main/java/de/tobias/playpad/server/ServerImpl.java @@ -71,9 +71,9 @@ public class ServerImpl implements Server, ChangeListener<ConnectionState> { private static final String PROTOCOL = "https"; private static final String WS_PROTOCOL = "wss"; - private String host; + private final String host; private WebSocket websocket; - private ServerSyncListener syncListener; + private final ServerSyncListener syncListener; ServerImpl(String host) { this.host = host; @@ -281,6 +281,7 @@ public class ServerImpl implements Server, ChangeListener<ConnectionState> { public void connect(String key) { try { WebSocketFactory webSocketFactory = new WebSocketFactory(); + webSocketFactory.setConnectionTimeout(5000); if (PlayPadMain.sslContext != null) { webSocketFactory.setSSLContext(PlayPadMain.sslContext); } -- GitLab