diff --git a/src/dorkbox/network/Client.java b/src/dorkbox/network/Client.java index 6d1ec7f2..c7417e01 100644 --- a/src/dorkbox/network/Client.java +++ b/src/dorkbox/network/Client.java @@ -277,7 +277,7 @@ class Client extends EndPointClient implements Connecti public void reconnect(int connectionTimeout) throws IOException { // close out all old connections - close(); + closeConnections(); connect(connectionTimeout); } @@ -468,15 +468,26 @@ class Client extends EndPointClient implements Connecti } /** - * Closes all connections ONLY (keeps the server/client running). + * Closes all connections ONLY (keeps the client running). To STOP the client, use stop(). + *

+ * This is used, for example, when reconnecting to a server. + */ + @Override + public + void closeConnections() { + synchronized (this.registrationLock) { + this.registrationLock.notify(); + } + } + + /** + * Closes all connections ONLY (keeps the client running). To STOP the client, use stop(). *

* This is used, for example, when reconnecting to a server. */ @Override public void close() { - synchronized (this.registrationLock) { - this.registrationLock.notify(); - } + closeConnections(); } } diff --git a/src/dorkbox/network/connection/EndPoint.java b/src/dorkbox/network/connection/EndPoint.java index 433fe6f7..dd71c03f 100644 --- a/src/dorkbox/network/connection/EndPoint.java +++ b/src/dorkbox/network/connection/EndPoint.java @@ -528,12 +528,14 @@ class EndPoint { ConnectionBridgeBase send(); /** - * Closes all connections ONLY (keeps the server/client running). + * Closes all connections ONLY (keeps the server/client running). To STOP the client/server, use stop(). *

- * This is used, for example, when reconnecting to a server. The server should ALWAYS use STOP. + * This is used, for example, when reconnecting to a server. + *

+ * The server should ALWAYS use STOP. */ public - void close() { + void closeConnections() { // give a chance to other threads. Thread.yield(); @@ -621,7 +623,7 @@ class EndPoint { // make sure we are not trying to stop during a startup procedure. // This will wait until we have finished starting up/shutting down. synchronized (this.shutdownInProgress) { - close(); + closeConnections(); this.logger.info("Stopping endpoint"); diff --git a/test/dorkbox/network/ReuseTest.java b/test/dorkbox/network/ReuseTest.java index d98b11ba..fa3afbe2 100644 --- a/test/dorkbox/network/ReuseTest.java +++ b/test/dorkbox/network/ReuseTest.java @@ -106,7 +106,7 @@ class ReuseTest extends BaseTest { } } - client.close(); + client.closeConnections(); } assertEquals(count * 2 * 2, this.clientCount.get() + this.serverCount.get()); @@ -177,7 +177,7 @@ class ReuseTest extends BaseTest { } } - client.close(); + client.closeConnections(); } assertEquals(count * 2, this.clientCount.get() + this.serverCount.get());