Added more support for criticalDriverErrors
This commit is contained in:
parent
d9bac748f8
commit
ce311fea86
|
@ -840,6 +840,15 @@ open class Client<CONNECTION : Connection>(
|
|||
}
|
||||
},
|
||||
onShutdown = {
|
||||
val criticalDriverError = aeronDriver.criticalDriverError
|
||||
val endpoints: Array<EndPoint<*>> = if (criticalDriverError) {
|
||||
aeronDriver.internal.endPointUsages.toTypedArray()
|
||||
} else {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
arrayOfNulls<EndPoint<*>?>(0) as Array<EndPoint<*>>
|
||||
}
|
||||
|
||||
|
||||
// this can be closed when the connection is remotely closed in ADDITION to manually closing
|
||||
logger.debug { "Client event dispatch closing..." }
|
||||
|
||||
|
|
|
@ -653,7 +653,18 @@ class AeronDriver private constructor(config: Configuration, val logger: KLogger
|
|||
*/
|
||||
suspend fun closed() = internal.closed()
|
||||
|
||||
suspend fun isInUse(): Boolean = internal.isInUse(logger)
|
||||
/**
|
||||
* Checks to see if there are any critical network errors (for example, a VPN connection getting disconnected while running)
|
||||
*/
|
||||
var criticalDriverError: Boolean
|
||||
get() {
|
||||
return internal.criticalDriverError
|
||||
}
|
||||
set(value) {
|
||||
internal.criticalDriverError = value
|
||||
}
|
||||
|
||||
suspend fun isInUse(endPoint: EndPoint<*>?): Boolean = internal.isInUse(endPoint, logger)
|
||||
|
||||
/**
|
||||
* @return the aeron media driver log file for a specific publication.
|
||||
|
|
|
@ -746,6 +746,12 @@ internal class AeronDriverInternal(endPoint: EndPoint<*>?, private val config: C
|
|||
return true
|
||||
}
|
||||
|
||||
// ignore the extra driver checks, because in SOME situations, when trying to reconnect upon an error, the
|
||||
// driver gets into a bad state. When this happens, we cannot rely on the driver stat info!
|
||||
if (criticalDriverError) {
|
||||
return false
|
||||
}
|
||||
|
||||
// check to see if we ALREADY have loaded this location.
|
||||
// null or empty snapshot means that this location is currently unused
|
||||
// >0 can also happen because the location is old. It's not running, but still has info because it hasn't been cleaned up yet
|
||||
|
|
Loading…
Reference in New Issue