You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/09/14 08:56:34 UTC
[1/2] guacamole-client git commit: GUACAMOLE-622: Increase size of
instruction queue within FailoverGuacamoleSocket. Allow limit to be
overridden.
Repository: guacamole-client
Updated Branches:
refs/heads/master d37100dc1 -> 0f93e7ff4
GUACAMOLE-622: Increase size of instruction queue within FailoverGuacamoleSocket. Allow limit to be overridden.
Some protocols, in particular SSH and telnet, may send a decent amount
of data before the connection status is known.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/e77ca735
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/e77ca735
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/e77ca735
Branch: refs/heads/master
Commit: e77ca735a07e851641067cbacf0ba61798511238
Parents: a34bbcf
Author: Michael Jumper <mj...@apache.org>
Authored: Sat Sep 1 14:35:01 2018 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Tue Sep 11 14:49:46 2018 -0700
----------------------------------------------------------------------
.../protocol/FailoverGuacamoleSocket.java | 50 ++++++++++++++++----
1 file changed, 42 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/e77ca735/guacamole-common/src/main/java/org/apache/guacamole/protocol/FailoverGuacamoleSocket.java
----------------------------------------------------------------------
diff --git a/guacamole-common/src/main/java/org/apache/guacamole/protocol/FailoverGuacamoleSocket.java b/guacamole-common/src/main/java/org/apache/guacamole/protocol/FailoverGuacamoleSocket.java
index 627c9fb..3c64c51 100644
--- a/guacamole-common/src/main/java/org/apache/guacamole/protocol/FailoverGuacamoleSocket.java
+++ b/guacamole-common/src/main/java/org/apache/guacamole/protocol/FailoverGuacamoleSocket.java
@@ -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;
}
@@ -187,6 +194,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
* emptied, reads are delegated directly to the reader of the wrapped
[2/2] guacamole-client git commit: GUACAMOLE-622: Merge increase
FailoverGuacamoleSocket instruction queue limit.
Posted by vn...@apache.org.
GUACAMOLE-622: Merge increase FailoverGuacamoleSocket instruction queue limit.
Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/0f93e7ff
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/0f93e7ff
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/0f93e7ff
Branch: refs/heads/master
Commit: 0f93e7ff452c36c5160b82fb685e5f3920dbd96a
Parents: d37100d e77ca73
Author: Nick Couchman <vn...@apache.org>
Authored: Fri Sep 14 04:55:49 2018 -0400
Committer: Nick Couchman <vn...@apache.org>
Committed: Fri Sep 14 04:55:49 2018 -0400
----------------------------------------------------------------------
.../protocol/FailoverGuacamoleSocket.java | 50 ++++++++++++++++----
1 file changed, 42 insertions(+), 8 deletions(-)
----------------------------------------------------------------------