GUAC-561: Throw timeout exception when socket times out.
This commit is contained in:
1 parent
6d4a83ce33
commit
03dbfa088e
2 files changed
+10
No files matched your search
@@ -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