mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-561: Throw timeout exception when socket times out.
This commit is contained in:
@@ -25,10 +25,12 @@ package org.glyptodon.guacamole.io;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.Deque;
|
||||
import java.util.LinkedList;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.GuacamoleServerException;
|
||||
import org.glyptodon.guacamole.GuacamoleUpstreamTimeoutException;
|
||||
import org.glyptodon.guacamole.protocol.GuacamoleInstruction;
|
||||
|
||||
/**
|
||||
@@ -177,6 +179,9 @@ public class ReaderGuacamoleReader implements GuacamoleReader {
|
||||
} // End read loop
|
||||
|
||||
}
|
||||
catch (SocketTimeoutException e) {
|
||||
throw new GuacamoleUpstreamTimeoutException("Connection to guacd timed out.", e);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new GuacamoleServerException(e);
|
||||
}
|
||||
|
@@ -36,8 +36,10 @@ import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.net.SocketTimeoutException;
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.GuacamoleServerException;
|
||||
import org.glyptodon.guacamole.GuacamoleUpstreamTimeoutException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -110,6 +112,9 @@ public class InetGuacamoleSocket implements GuacamoleSocket {
|
||||
writer = new WriterGuacamoleWriter(new OutputStreamWriter(sock.getOutputStream(), "UTF-8"));
|
||||
|
||||
}
|
||||
catch (SocketTimeoutException e) {
|
||||
throw new GuacamoleUpstreamTimeoutException("Connection timed out.", e);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw new GuacamoleServerException(e);
|
||||
}
|
||||
|
Reference in New Issue
Block a user