mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-1048: Use GuacamoleConnectionClosedException to represent explicit connection closure.
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
package org.apache.guacamole.protocol;
|
package org.apache.guacamole.protocol;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.guacamole.GuacamoleConnectionClosedException;
|
||||||
import org.apache.guacamole.GuacamoleException;
|
import org.apache.guacamole.GuacamoleException;
|
||||||
import org.apache.guacamole.GuacamoleServerException;
|
import org.apache.guacamole.GuacamoleServerException;
|
||||||
import org.apache.guacamole.io.GuacamoleReader;
|
import org.apache.guacamole.io.GuacamoleReader;
|
||||||
@@ -132,11 +133,18 @@ public class ConfiguredGuacamoleSocket extends DelegatingGuacamoleSocket {
|
|||||||
* Respects server control instructions that are allowed during the handshake
|
* Respects server control instructions that are allowed during the handshake
|
||||||
* phase, namely {@code error} and {@code disconnect}.
|
* phase, namely {@code error} and {@code disconnect}.
|
||||||
*
|
*
|
||||||
* @param reader The reader to read instructions from.
|
* @param reader
|
||||||
* @param opcode The opcode of the instruction we are expecting.
|
* The reader to read instructions from.
|
||||||
* @return The instruction having the given opcode.
|
*
|
||||||
* @throws GuacamoleException If an error occurs while reading, or if
|
* @param opcode
|
||||||
* the expected instruction is not read.
|
* The opcode of the instruction we are expecting.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* The instruction having the given opcode.
|
||||||
|
*
|
||||||
|
* @throws GuacamoleException
|
||||||
|
* If an error occurs while reading, or if the expected instruction is
|
||||||
|
* not read.
|
||||||
*/
|
*/
|
||||||
private GuacamoleInstruction expect(GuacamoleReader reader, String opcode)
|
private GuacamoleInstruction expect(GuacamoleReader reader, String opcode)
|
||||||
throws GuacamoleException {
|
throws GuacamoleException {
|
||||||
@@ -146,9 +154,11 @@ public class ConfiguredGuacamoleSocket extends DelegatingGuacamoleSocket {
|
|||||||
if (instruction == null)
|
if (instruction == null)
|
||||||
throw new GuacamoleServerException("End of stream while waiting for \"" + opcode + "\".");
|
throw new GuacamoleServerException("End of stream while waiting for \"" + opcode + "\".");
|
||||||
|
|
||||||
// Handle server control instructions
|
// Report connection closure if server explicitly disconnects
|
||||||
if ("disconnect".equals(instruction.getOpcode()))
|
if ("disconnect".equals(instruction.getOpcode()))
|
||||||
throw new GuacamoleServerException("Server disconnected while waiting for \"" + opcode + "\".");
|
throw new GuacamoleConnectionClosedException("Server disconnected while waiting for \"" + opcode + "\".");
|
||||||
|
|
||||||
|
// Pass through any received errors as GuacamoleExceptions
|
||||||
if ("error".equals(instruction.getOpcode()))
|
if ("error".equals(instruction.getOpcode()))
|
||||||
handleReceivedError(instruction);
|
handleReceivedError(instruction);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user