Cleaned up fragment-limit for poll, added comments

This commit is contained in:
nathan 2020-08-26 16:27:59 +02:00
parent efa032740a
commit 39503ac6d9
3 changed files with 13 additions and 4 deletions

View File

@ -229,8 +229,11 @@ open class Server<CONNECTION : Connection>(config: ServerConfiguration = ServerC
while (!isShutdown()) {
pollCount = 0
// NOTE: regarding fragment limit size. Repeated calls to '.poll' will reassemble a fragment.
// `.poll(handler, 4)` == `.poll(handler, 2)` + `.poll(handler, 2)`
// this checks to see if there are NEW clients on the handshake ports
pollCount += handshakeSubscription.poll(handshakeHandler, 4)
pollCount += handshakeSubscription.poll(handshakeHandler, 2)
// this checks to see if there are NEW clients via IPC
// pollCount += ipcHandshakeSubscription.poll(ipcInitialConnectionHandler, 100)

View File

@ -191,7 +191,9 @@ open class Connection(connectionParameters: ConnectionParams<*>) {
* Polls the AERON media driver subscription channel for incoming messages
*/
internal fun pollSubscriptions(): Int {
return subscription.poll(messageHandler, 4)
// NOTE: regarding fragment limit size. Repeated calls to '.poll' will reassemble a fragment.
// `.poll(handler, 4)` == `.poll(handler, 2)` + `.poll(handler, 2)`
return subscription.poll(messageHandler, 2)
}
/**

View File

@ -123,7 +123,9 @@ internal class ClientHandshake<CONNECTION: Connection>(private val logger: KLogg
val startTime = System.currentTimeMillis()
while (System.currentTimeMillis() - startTime < connectionTimeoutMS) {
pollCount = subscription.poll(handler, 1024)
// NOTE: regarding fragment limit size. Repeated calls to '.poll' will reassemble a fragment.
// `.poll(handler, 4)` == `.poll(handler, 2)` + `.poll(handler, 2)`
pollCount = subscription.poll(handler, 2)
if (failed != null) {
// no longer necessary to hold this connection open
@ -165,7 +167,9 @@ internal class ClientHandshake<CONNECTION: Connection>(private val logger: KLogg
val startTime = System.currentTimeMillis()
while (System.currentTimeMillis() - startTime < connectionTimeoutMS) {
pollCount = subscription.poll(handler, 1024)
// NOTE: regarding fragment limit size. Repeated calls to '.poll' will reassemble a fragment.
// `.poll(handler, 4)` == `.poll(handler, 2)` + `.poll(handler, 2)`
pollCount = subscription.poll(handler, 2)
if (failed != null) {
// no longer necessary to hold this connection open