diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java | 15 | ||||
-rw-r--r-- | src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java b/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java index 0318965..c886397 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/AvailableClient.java @@ -9,7 +9,7 @@ import org.slf4j.LoggerFactory; import de.bwlehrpool.bwlp_guac.JsonClient.State; -public class AvailableClient { +public class AvailableClient implements Cloneable { private static final Logger LOGGER = LoggerFactory.getLogger(AvailableClient.class); @@ -37,6 +37,10 @@ public class AvailableClient { this.clientip = source.clientip; update(source); } + + private AvailableClient(String clientip) { + this.clientip = clientip; + } /** * Update this client's state, resetting "in use" if appropriate. Ie, the @@ -154,5 +158,14 @@ public class AvailableClient { return this.connectionOk = false; } } + + @Override + public AvailableClient clone() { + AvailableClient c = new AvailableClient(this.clientip); + c.state = this.state; + c.inUseBy = this.inUseBy; + c.password = this.password; + return c; + } } diff --git a/src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java b/src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java index 616c20c..3d46e73 100644 --- a/src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java +++ b/src/main/java/de/bwlehrpool/bwlp_guac/WrappedConnection.java @@ -11,7 +11,7 @@ public class WrappedConnection extends SimpleConnection { public WrappedConnection(String name, AvailableClient ac) { super(name, name, makeConfig(ac)); - this.ac = ac; + this.ac = ac.clone(); setParentIdentifier(DEFAULT_ROOT_CONNECTION_GROUP); } |