mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
GUAC-1132: Associate active socket with connection record.
This commit is contained in:
@@ -352,11 +352,8 @@ public abstract class AbstractGuacamoleSocketService implements GuacamoleSocketS
|
|||||||
* The connection will be automatically released when it closes, or if it
|
* The connection will be automatically released when it closes, or if it
|
||||||
* fails to establish entirely.
|
* fails to establish entirely.
|
||||||
*
|
*
|
||||||
* @param user
|
* @param activeConnection
|
||||||
* The user for whom the connection is being established.
|
* The active connection record of the connection in use.
|
||||||
*
|
|
||||||
* @param connection
|
|
||||||
* The connection the user is connecting to.
|
|
||||||
*
|
*
|
||||||
* @param info
|
* @param info
|
||||||
* Information describing the Guacamole client connecting to the given
|
* Information describing the Guacamole client connecting to the given
|
||||||
@@ -370,7 +367,7 @@ public abstract class AbstractGuacamoleSocketService implements GuacamoleSocketS
|
|||||||
* If an error occurs while the connection is being established, or
|
* If an error occurs while the connection is being established, or
|
||||||
* while connection configuration information is being retrieved.
|
* while connection configuration information is being retrieved.
|
||||||
*/
|
*/
|
||||||
private GuacamoleSocket getGuacamoleSocket(ActiveConnectionRecord activeConnection,
|
private GuacamoleSocket assignGuacamoleSocket(ActiveConnectionRecord activeConnection,
|
||||||
GuacamoleClientInformation info)
|
GuacamoleClientInformation info)
|
||||||
throws GuacamoleException {
|
throws GuacamoleException {
|
||||||
|
|
||||||
@@ -382,13 +379,19 @@ public abstract class AbstractGuacamoleSocketService implements GuacamoleSocketS
|
|||||||
activeConnections.put(connection.getIdentifier(), activeConnection);
|
activeConnections.put(connection.getIdentifier(), activeConnection);
|
||||||
activeConnectionGroups.put(connection.getParentIdentifier(), activeConnection);
|
activeConnectionGroups.put(connection.getParentIdentifier(), activeConnection);
|
||||||
|
|
||||||
// Return new socket
|
|
||||||
try {
|
try {
|
||||||
return new ConfiguredGuacamoleSocket(
|
|
||||||
|
// Obtain socket which will automatically run the cleanup task
|
||||||
|
GuacamoleSocket socket = new ConfiguredGuacamoleSocket(
|
||||||
getUnconfiguredGuacamoleSocket(cleanupTask),
|
getUnconfiguredGuacamoleSocket(cleanupTask),
|
||||||
getGuacamoleConfiguration(activeConnection.getUser(), connection),
|
getGuacamoleConfiguration(activeConnection.getUser(), connection),
|
||||||
info
|
info
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Assign and return new socket
|
||||||
|
activeConnection.setActiveSocket(socket);
|
||||||
|
return socket;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute cleanup if socket could not be created
|
// Execute cleanup if socket could not be created
|
||||||
@@ -462,7 +465,7 @@ public abstract class AbstractGuacamoleSocketService implements GuacamoleSocketS
|
|||||||
|
|
||||||
// Acquire and connect to single connection
|
// Acquire and connect to single connection
|
||||||
acquire(user, Collections.singletonList(connection));
|
acquire(user, Collections.singletonList(connection));
|
||||||
return getGuacamoleSocket(new ActiveConnectionRecord(user, connection), info);
|
return assignGuacamoleSocket(new ActiveConnectionRecord(user, connection), info);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,7 +490,7 @@ public abstract class AbstractGuacamoleSocketService implements GuacamoleSocketS
|
|||||||
|
|
||||||
// Acquire and connect to any child
|
// Acquire and connect to any child
|
||||||
ModeledConnection connection = acquire(user, connections);
|
ModeledConnection connection = acquire(user, connections);
|
||||||
return getGuacamoleSocket(new ActiveConnectionRecord(user, connectionGroup, connection), info);
|
return assignGuacamoleSocket(new ActiveConnectionRecord(user, connectionGroup, connection), info);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -62,6 +62,12 @@ public class ActiveConnectionRecord implements ConnectionRecord {
|
|||||||
*/
|
*/
|
||||||
private final Date startDate = new Date();
|
private final Date startDate = new Date();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The GuacamoleSocket used by the connection associated with this
|
||||||
|
* connection record.
|
||||||
|
*/
|
||||||
|
private GuacamoleSocket socket;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new connection record associated with the given user,
|
* Creates a new connection record associated with the given user,
|
||||||
* connection, and balancing connection group. The given balancing
|
* connection, and balancing connection group. The given balancing
|
||||||
@@ -189,8 +195,17 @@ public class ActiveConnectionRecord implements ConnectionRecord {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GuacamoleSocket getActiveSocket() {
|
public GuacamoleSocket getActiveSocket() {
|
||||||
// STUB
|
return socket;
|
||||||
return null;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Associates the given GuacamoleSocket with this connection record.
|
||||||
|
*
|
||||||
|
* @param socket
|
||||||
|
* The GuacamoleSocket to associate with this connection record.
|
||||||
|
*/
|
||||||
|
public void setActiveSocket(GuacamoleSocket socket) {
|
||||||
|
this.socket = socket;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user