Client/Server isRunning checks will COPY the config instead, so that we don't "hack" the configs to make sure they continue working as expected

This commit is contained in:
Robinson 2023-06-29 20:56:43 +02:00
parent c0e8cbf28f
commit ae67bb4899
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
3 changed files with 9 additions and 9 deletions

View File

@ -132,7 +132,7 @@ open class Client<CONNECTION : Connection>(
val timeout = TimeUnit.SECONDS.toMillis(configuration.connectionCloseTimeoutInSeconds.toLong() * 2)
val logger = KotlinLogging.logger(Client::class.java.simpleName)
AeronDriver.ensureStopped(configuration, logger, timeout)
AeronDriver.ensureStopped(configuration.copy(), logger, timeout)
}
/**
@ -144,7 +144,7 @@ open class Client<CONNECTION : Connection>(
*/
fun isRunning(configuration: Configuration): Boolean = runBlocking {
val logger = KotlinLogging.logger(Client::class.java.simpleName)
AeronDriver.isRunning(configuration, logger)
AeronDriver.isRunning(configuration.copy(), logger)
}
init {
@ -567,9 +567,8 @@ open class Client<CONNECTION : Connection>(
logger = logger
)
// Note: the pub/sub info is from the perspective of the SERVER
val pubSub = handshakeConnection.pubSub
val logInfo = pubSub.reverseForClient().getLogInfo(logger.isDebugEnabled)
val logInfo = pubSub.getLogInfo(logger.isDebugEnabled)
if (logger.isDebugEnabled) {
logger.debug { "Creating new handshake to $logInfo" }
@ -791,7 +790,10 @@ open class Client<CONNECTION : Connection>(
// we only need to run shutdown methods if there was a network outage or D/C
if (!shutdownInProgress.value) {
this@Client.closeSuspending(false)
this@Client.closeSuspending(
closeEverything = false,
initiatedByClientClose = true,
initiatedByShutdown = false)
}
// we can now call connect again

View File

@ -133,7 +133,7 @@ open class Server<CONNECTION : Connection>(
val timeout = TimeUnit.SECONDS.toMillis(configuration.connectionCloseTimeoutInSeconds.toLong() * 2)
val logger = KotlinLogging.logger(Server::class.java.simpleName)
AeronDriver.ensureStopped(configuration, logger, timeout)
AeronDriver.ensureStopped(configuration.copy(), logger, timeout)
}
/**
@ -145,7 +145,7 @@ open class Server<CONNECTION : Connection>(
*/
fun isRunning(configuration: ServerConfiguration): Boolean = runBlocking {
val logger = KotlinLogging.logger(Server::class.java.simpleName)
AeronDriver.isRunning(configuration, logger)
AeronDriver.isRunning(configuration.copy(), logger)
}
init {

View File

@ -139,8 +139,6 @@ class AeronDriver private constructor(config: Configuration, val logger: KLogger
it.isRunning()
}
// hacky, but necessary for multiple checks
configuration.contextDefined = false
return running
}