mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	GUACAMOLE-622: Merge increase FailoverGuacamoleSocket instruction queue limit.
This commit is contained in:
		| @@ -49,11 +49,10 @@ public class FailoverGuacamoleSocket implements GuacamoleSocket { | ||||
|             LoggerFactory.getLogger(FailoverGuacamoleSocket.class); | ||||
|  | ||||
|     /** | ||||
|      * The maximum number of characters of Guacamole instruction data to store | ||||
|      * within the instruction queue while searching for errors. Once this limit | ||||
|      * is exceeded, the connection is assumed to be successful. | ||||
|      * The default maximum number of characters of Guacamole instruction data | ||||
|      * to store if no explicit limit is provided. | ||||
|      */ | ||||
|     private static final int INSTRUCTION_QUEUE_LIMIT = 2048; | ||||
|     private static final int DEFAULT_INSTRUCTION_QUEUE_LIMIT = 131072; | ||||
|  | ||||
|     /** | ||||
|      * The wrapped socket being used. | ||||
| @@ -131,9 +130,11 @@ public class FailoverGuacamoleSocket implements GuacamoleSocket { | ||||
|     /** | ||||
|      * Creates a new FailoverGuacamoleSocket which reads Guacamole instructions | ||||
|      * from the given socket, searching for errors from the upstream remote | ||||
|      * desktop. If an upstream error is encountered, it is thrown as a | ||||
|      * desktop until the given instruction queue limit is reached. If an | ||||
|      * upstream error is encountered, it is thrown as a | ||||
|      * GuacamoleUpstreamException. This constructor will block until an error | ||||
|      * is encountered, or until the connection appears to have been successful. | ||||
|      * is encountered, until insufficient space remains in the instruction | ||||
|      * queue, or until the connection appears to have been successful. | ||||
|      * Once the FailoverGuacamoleSocket has been created, all reads, writes, | ||||
|      * etc. will be delegated to the provided socket. | ||||
|      * | ||||
| @@ -141,6 +142,11 @@ public class FailoverGuacamoleSocket implements GuacamoleSocket { | ||||
|      *     The GuacamoleSocket of the Guacamole connection this | ||||
|      *     FailoverGuacamoleSocket should handle. | ||||
|      * | ||||
|      * @param instructionQueueLimit | ||||
|      *     The maximum number of characters of Guacamole instruction data to | ||||
|      *     store within the instruction queue while searching for errors. Once | ||||
|      *     this limit is exceeded, the connection is assumed to be successful. | ||||
|      * | ||||
|      * @throws GuacamoleException | ||||
|      *     If an error occurs while reading data from the provided socket. | ||||
|      * | ||||
| @@ -148,7 +154,8 @@ public class FailoverGuacamoleSocket implements GuacamoleSocket { | ||||
|      *     If the connection to guacd succeeded, but an error occurred while | ||||
|      *     connecting to the remote desktop. | ||||
|      */ | ||||
|     public FailoverGuacamoleSocket(GuacamoleSocket socket) | ||||
|     public FailoverGuacamoleSocket(GuacamoleSocket socket, | ||||
|             final int instructionQueueLimit) | ||||
|             throws GuacamoleException, GuacamoleUpstreamException { | ||||
|  | ||||
|         int totalQueueSize = 0; | ||||
| @@ -177,7 +184,7 @@ public class FailoverGuacamoleSocket implements GuacamoleSocket { | ||||
|             // Otherwise, track total data parsed, and assume connection is | ||||
|             // successful if no error encountered within reasonable space | ||||
|             totalQueueSize += instruction.toString().length(); | ||||
|             if (totalQueueSize >= INSTRUCTION_QUEUE_LIMIT) | ||||
|             if (totalQueueSize >= instructionQueueLimit) | ||||
|                 break; | ||||
|  | ||||
|         } | ||||
| @@ -186,6 +193,33 @@ public class FailoverGuacamoleSocket implements GuacamoleSocket { | ||||
|  | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Creates a new FailoverGuacamoleSocket which reads Guacamole instructions | ||||
|      * from the given socket, searching for errors from the upstream remote | ||||
|      * desktop until a maximum of 128KB of instruction data has been queued. If | ||||
|      * an upstream error is encountered, it is thrown as a | ||||
|      * GuacamoleUpstreamException. This constructor will block until an error | ||||
|      * is encountered, until insufficient space remains in the instruction | ||||
|      * queue, or until the connection appears to have been successful. | ||||
|      * Once the FailoverGuacamoleSocket has been created, all reads, writes, | ||||
|      * etc. will be delegated to the provided socket. | ||||
|      * | ||||
|      * @param socket | ||||
|      *     The GuacamoleSocket of the Guacamole connection this | ||||
|      *     FailoverGuacamoleSocket should handle. | ||||
|      * | ||||
|      * @throws GuacamoleException | ||||
|      *     If an error occurs while reading data from the provided socket. | ||||
|      * | ||||
|      * @throws GuacamoleUpstreamException | ||||
|      *     If the connection to guacd succeeded, but an error occurred while | ||||
|      *     connecting to the remote desktop. | ||||
|      */ | ||||
|     public FailoverGuacamoleSocket(GuacamoleSocket socket) | ||||
|             throws GuacamoleException, GuacamoleUpstreamException { | ||||
|         this(socket, DEFAULT_INSTRUCTION_QUEUE_LIMIT); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * GuacamoleReader which reads instructions from the queue populated when | ||||
|      * the FailoverGuacamoleSocket was constructed. Once the queue has been | ||||
|   | ||||
		Reference in New Issue
	
	Block a user