more info in comments

This commit is contained in:
Robinson 2021-04-30 18:18:59 +02:00
parent dfaf583f4f
commit 0b95a4503d
2 changed files with 6 additions and 12 deletions

View File

@ -78,6 +78,7 @@ internal class ResponseManager(private val logger: KLogger, private val actionDi
} }
} catch (e: ClosedSendChannelException) { } catch (e: ClosedSendChannelException) {
// this can happen if we are starting/stopping an endpoint (and thus a response-manager) VERY quickly, and can be ignored // this can happen if we are starting/stopping an endpoint (and thus a response-manager) VERY quickly, and can be ignored
logger.trace("Error during RMI preparation. Usually this is caused by fast a start/stop")
} }
} }
} }
@ -91,7 +92,7 @@ internal class ResponseManager(private val logger: KLogger, private val actionDi
val rmiId = RmiUtils.unpackUnsignedRight(message.packedId) val rmiId = RmiUtils.unpackUnsignedRight(message.packedId)
val result = message.result val result = message.result
logger.trace { "RMI return: $rmiId" } logger.trace { "RMI return message: $rmiId" }
val previous = pendingLock.write { val previous = pendingLock.write {
val previous = pending[rmiId] val previous = pending[rmiId]
@ -101,7 +102,7 @@ internal class ResponseManager(private val logger: KLogger, private val actionDi
// if NULL, since either we don't exist (because we were async), or it was cancelled // if NULL, since either we don't exist (because we were async), or it was cancelled
if (previous is ResponseWaiter) { if (previous is ResponseWaiter) {
logger.trace { "RMI valid-cancel: $rmiId" } logger.trace { "RMI valid-cancel onMessage: $rmiId" }
// this means we were NOT timed out! (we cannot be timed out here) // this means we were NOT timed out! (we cannot be timed out here)
previous.doNotify() previous.doNotify()
@ -212,10 +213,6 @@ internal class ResponseManager(private val logger: KLogger, private val actionDi
/////// ///////
/////// ///////
/** /**
* on response, runs the waiting callback * on response, runs the waiting callback
* NOTE: This uses the RMI-ID mechanism to know what the response ID is (the name is left alone) * NOTE: This uses the RMI-ID mechanism to know what the response ID is (the name is left alone)
@ -224,7 +221,7 @@ internal class ResponseManager(private val logger: KLogger, private val actionDi
val rmiId = RmiUtils.unpackUnsignedRight(message.packedId) val rmiId = RmiUtils.unpackUnsignedRight(message.packedId)
val result = message.result val result = message.result
logger.trace { "RMI return: $rmiId" } logger.trace { "RMI return callback: $rmiId" }
val previous = pendingLock.write { val previous = pendingLock.write {
val previous = pending[rmiId] val previous = pending[rmiId]
@ -234,16 +231,13 @@ internal class ResponseManager(private val logger: KLogger, private val actionDi
// if NULL, since either we don't exist (because we were async), or it was cancelled // if NULL, since either we don't exist (because we were async), or it was cancelled
if (previous is ResponseWaiter) { if (previous is ResponseWaiter) {
logger.trace { "RMI valid-cancel: $rmiId" } logger.trace { "RMI valid-cancel onCallback: $rmiId" }
// this means we were NOT timed out! (we cannot be timed out here) // this means we were NOT timed out! (we cannot be timed out here)
previous.doNotify() previous.doNotify()
} }
} }
/** /**
* gets the ResponseWaiter (id + waiter) and prepares the pending response map * gets the ResponseWaiter (id + waiter) and prepares the pending response map
* *

View File

@ -347,7 +347,7 @@ internal class RmiManagerGlobal<CONNECTION : Connection>(logger: KLogger,
} }
private suspend fun returnRmiMessage(connection: Connection, message: MethodRequest, result: Any?, logger: KLogger) { private suspend fun returnRmiMessage(connection: Connection, message: MethodRequest, result: Any?, logger: KLogger) {
logger.trace { "RMI returned: ${RmiUtils.unpackUnsignedRight(message.packedId)}" } logger.trace { "RMI return. Send: ${RmiUtils.unpackUnsignedRight(message.packedId)}" }
val rmiMessage = MethodResponse() val rmiMessage = MethodResponse()
rmiMessage.packedId = message.packedId rmiMessage.packedId = message.packedId