-
Notifications
You must be signed in to change notification settings - Fork 711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GUACAMOLE-1126: Set a maximum of 4 auto-reconnect attempts #547
Draft
echu2013
wants to merge
4
commits into
apache:main
Choose a base branch
from
echu2013:JIRA/GUACAMOLE-1126
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1ba5f18
GUACAMOLE-1126: Set a maximum of 4 auto-reconnect attempts
echu2013 7c91cde
GUACAMOLE-1126: Add Auto-Reconnect options and translations
echu2013 1c030d7
GUACAMOLE-1126: Minor corrections in translations
9ec8b11
Merge remote-tracking branch 'remotes/upstream-apache/master' into JI…
echu2013 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,16 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams | |
var requestService = $injector.get('requestService'); | ||
var tunnelService = $injector.get('tunnelService'); | ||
var userPageService = $injector.get('userPageService'); | ||
|
||
/** | ||
* Counter and limiter for maximum auto-reconnect attempts that we should | ||
* automatically try to establish a connection when CLIENT_AUTO_RECONNECT or | ||
* TUNNEL_AUTO_RECONNECT error types occur. | ||
* | ||
* @type Number | ||
*/ | ||
var AUTO_RECONNECT_TRY = 0; | ||
var AUTO_RECONNECT_MAXTRY = 4; | ||
|
||
/** | ||
* The minimum number of pixels a drag gesture must move to result in the | ||
|
@@ -770,7 +780,13 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams | |
var errorName = (status in CLIENT_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT"; | ||
|
||
// Determine whether the reconnect countdown applies | ||
var countdown = (status in CLIENT_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null; | ||
if (status in CLIENT_AUTO_RECONNECT && AUTO_RECONNECT_TRY < AUTO_RECONNECT_MAXTRY ) { | ||
var countdown = RECONNECT_COUNTDOWN; | ||
AUTO_RECONNECT_TRY++; | ||
} else { | ||
var countdown = null; | ||
AUTO_RECONNECT_TRY = 0; | ||
} | ||
|
||
// Show error status | ||
notifyConnectionClosed({ | ||
|
@@ -792,7 +808,13 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams | |
var errorName = (status in TUNNEL_ERRORS) ? status.toString(16).toUpperCase() : "DEFAULT"; | ||
|
||
// Determine whether the reconnect countdown applies | ||
var countdown = (status in TUNNEL_AUTO_RECONNECT) ? RECONNECT_COUNTDOWN : null; | ||
if (status in TUNNEL_AUTO_RECONNECT && AUTO_RECONNECT_TRY < AUTO_RECONNECT_MAXTRY ) { | ||
var countdown = RECONNECT_COUNTDOWN; | ||
AUTO_RECONNECT_TRY++; | ||
} else { | ||
var countdown = null; | ||
AUTO_RECONNECT_TRY = 0; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since the countdown is already part of the notification, I would think it would be pretty easy to add the number of tries and max tries pretty easily. |
||
|
||
// Show error status | ||
notifyConnectionClosed({ | ||
|
@@ -828,6 +850,8 @@ angular.module('client').controller('clientController', ['$scope', '$routeParams | |
|
||
// Hide status notification | ||
guacNotification.showStatus(false); | ||
// Reset auto-reconnect attempts counter | ||
AUTO_RECONNECT_TRY = 0; | ||
|
||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, rather than setting a constant, here, I would say:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can we get a profile's parameter value within clientController.js?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any chance we can get any parameter without modifying guacamole-server @necouchman ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we definitely won't need to modify guacamole-server, as the connection attributes all stay on the guacamole-client side and are available via the REST API. However, there will be some changes required to the various Java classes in guacamole-client, along with the JDBC extensions, to support storage of the attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At least a couple of places that would need to be changed would be:
https://github.com/apache/guacamole-client/blob/master/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ConnectionModel.java
https://github.com/apache/guacamole-client/blob/master/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/connection/ModeledConnection.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of this similar in light of the VNC
autoretry
parameter, but maybe the goals and implementation details are slightly different. I guess that parameter does the retries transparently in the background (guacd side), while to the client it only looks like a single connection attempt. There was mention when implementing WoL support (GUACAMOLE-513) of the possibility of supportingautoretry
with some configurable timers/limits across the board.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mike-jumper @necouchman I am sorry but I don't understand why would be need to modify guacamole's schema to achieve this..
Why can't we just use
guacamole_connection_parameter
which already holds all kind of profile parameters under column namedparameter_name
???What I've done so far is an addition of 3 parameters (autoreconnect-disable, autoreconnect-maxretries, autoreconnect-wait-seconds) which I need to get in
clientController.js
somehow...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because those aren't connection parameters. Connection parameters are a specific type of name/value pairs and are defined by the protocol plugins used by guacd. Connection parameter storage should not be used for anything that isn't a connection parameter.
There is a built-in facility for arbitrary name/value pair storage for connections (connection attributes), and this would be the appropriate vehicle for these changes. New connection attributes do not generally require schema changes, at least in the case of non-standard attributes.
Thus: connection parameters would be a non-starter, but connection attributes would be (generally) fine.
The awkwardness in this particular change comes from:
So ... yes, you're not wrong that it could be done as you describe, but it really should not be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok @mike-jumper I get your point.
So, you intend to extend this
guacamole_connection
table columns:in order to include "reconnection" parameters?
Or, do you have another idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly. This would be the correct approach if standard attributes are going to be used here, but I strongly wish to avoid this.
Yes, listed above in an earlier comment. Specifically:
I would lean toward the latter (ensuring automated reconnect attempts do not prevent a session from expiring). It avoids schema changes, API changes, and any additional configuration, and instead simply leverages existing behavior to solve the issue motivating GUACAMOLE-1126.