diff --git a/src/dorkbox/network/Server.kt b/src/dorkbox/network/Server.kt index d8b683e0..7808a0bd 100644 --- a/src/dorkbox/network/Server.kt +++ b/src/dorkbox/network/Server.kt @@ -26,9 +26,9 @@ import dorkbox.network.connection.Connection import dorkbox.network.connection.EndPoint import dorkbox.network.connection.ListenerManager import dorkbox.network.connectionType.ConnectionRule +import dorkbox.network.coroutines.SuspendWaiter import dorkbox.network.exceptions.ServerException import dorkbox.network.handshake.ServerHandshake -import dorkbox.network.coroutines.SuspendWaiter import dorkbox.network.rmi.RemoteObject import dorkbox.network.rmi.RemoteObjectStorage import dorkbox.network.rmi.TimeoutException @@ -584,6 +584,15 @@ open class Server(config: ServerConfiguration = ServerC } } + /** + * Execute the unit function against all existing connections + */ + fun forEachConnection(function: (connection: CONNECTION) -> Unit) { + connections.forEach { + function(it) + } + } + /** * Closes the server and all it's connections. After a close, you may call 'bind' again. */