code cleanup

This commit is contained in:
Robinson 2023-05-28 17:03:54 +02:00
parent 167de54114
commit cf875832d9
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C

View File

@ -376,7 +376,8 @@ open class Server<CONNECTION : Connection>(
// finish closing -- this lets us make sure that we don't run into race conditions on the thread that calls close() // finish closing -- this lets us make sure that we don't run into race conditions on the thread that calls close()
try { try {
shutdownEventLatch.countDown() shutdownEventLatch.countDown()
} catch (ignored: Exception) {} } catch (ignored: Exception) {
}
} }
}) })
} }
@ -409,9 +410,11 @@ open class Server<CONNECTION : Connection>(
* *
* This function will be called for **only** network clients (IPC client are excluded) * This function will be called for **only** network clients (IPC client are excluded)
*/ */
fun filter(ipFilterRule: IpFilterRule) = runBlocking { fun filter(ipFilterRule: IpFilterRule) {
runBlocking {
listenerManager.filter(ipFilterRule) listenerManager.filter(ipFilterRule)
} }
}
/** /**
* Adds a function that will be called BEFORE a client/server "connects" with each other, and used to determine if a connection * Adds a function that will be called BEFORE a client/server "connects" with each other, and used to determine if a connection
@ -431,9 +434,11 @@ open class Server<CONNECTION : Connection>(
* *
* This function will be called for **only** network clients (IPC client are excluded) * This function will be called for **only** network clients (IPC client are excluded)
*/ */
fun filter(function: CONNECTION.() -> Boolean) = runBlocking { fun filter(function: CONNECTION.() -> Boolean) {
runBlocking {
listenerManager.filter(function) listenerManager.filter(function)
} }
}
/** /**
* Runs an action for each connection * Runs an action for each connection