renamed function: isConnected -> isClosedWithTimeout

This commit is contained in:
Robinson 2023-10-18 19:54:07 +02:00
parent d51c878a65
commit 7cacc63dca
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
4 changed files with 4 additions and 4 deletions

View File

@ -831,7 +831,7 @@ open class Client<CONNECTION : Connection>(config: ClientConfiguration = ClientC
override fun invoke(): Int {
// if we initiate a disconnect manually, then there is no need to wait for aeron to verify it's closed
// we only want to wait for aeron to verify it's closed if we are SUPPOSED to be connected, but there's a network blip
return if (!(shutdownEventPoller || newConnection.isClosed() || newConnection.isConnected())) {
return if (!(shutdownEventPoller || newConnection.isClosed() || newConnection.isClosedWithTimeout())) {
newConnection.poll()
} else {
// If the connection has either been closed, or has expired, it needs to be cleaned-up/deleted.

View File

@ -230,7 +230,7 @@ open class Server<CONNECTION : Connection>(config: ServerConfiguration = ServerC
// this manages existing clients (for cleanup + connection polling). This has a concurrent iterator,
// so we can modify this as we go
connections.forEach { connection ->
if (!(connection.isClosed() || connection.isConnected()) ) {
if (!(connection.isClosed() || connection.isClosedWithTimeout()) ) {
// Otherwise, poll the connection for messages
pollCount += connection.poll()
} else {

View File

@ -290,7 +290,7 @@ open class Connection(connectionParameters: ConnectionParams<*>) {
*
* @return `true` if this connection has been closed via aeron
*/
fun isConnected(): Boolean {
fun isClosedWithTimeout(): Boolean {
// we ONLY want to actually, legit check, 1 time every XXX ms.
val now = System.nanoTime()

View File

@ -113,7 +113,7 @@ open class Session<CONNECTION: SessionConnection>(@Volatile var connection: CONN
pendingMessagesQueue.put(message)
connection.logger.error("[{}] queueing message", connection)
}
else if (!connection.isConnected()) {
else if (!connection.isClosedWithTimeout()) {
// there was an issue - the connection should automatically reconnect
pendingMessagesQueue.put(message)
connection.logger.error("[{}] queueing message", connection)