close the sub/pub for a client when it fails to connect (prevent disk space leak)
This commit is contained in:
parent
a7e520caed
commit
ad4073c632
@ -496,11 +496,6 @@ open class Client<CONNECTION : Connection>(
|
|||||||
connect0(handshake, handshakeConnection, handshakeTimeoutSec)
|
connect0(handshake, handshakeConnection, handshakeTimeoutSec)
|
||||||
success = true
|
success = true
|
||||||
|
|
||||||
|
|
||||||
// finished with the handshake, so always close the connection publication
|
|
||||||
// The subscription is RE-USED, so we don't close that!
|
|
||||||
handshakeConnection.publication.close()
|
|
||||||
|
|
||||||
// once we're done with the connection process, stop trying
|
// once we're done with the connection process, stop trying
|
||||||
break
|
break
|
||||||
} catch (e: ClientRetryException) {
|
} catch (e: ClientRetryException) {
|
||||||
@ -754,6 +749,10 @@ open class Client<CONNECTION : Connection>(
|
|||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// finished with the handshake, so always close the connection publication
|
||||||
|
// The subscription is RE-USED, so we don't close that!
|
||||||
|
handshakeConnection.publication.close()
|
||||||
|
|
||||||
isConnected = true
|
isConnected = true
|
||||||
|
|
||||||
logger.debug { "[$aeronLogInfo - ${handshake.connectKey}] Connection (${newConnection.id}) to $remoteAddressString done with handshake." }
|
logger.debug { "[$aeronLogInfo - ${handshake.connectKey}] Connection (${newConnection.id}) to $remoteAddressString done with handshake." }
|
||||||
|
@ -276,6 +276,10 @@ internal class ClientHandshake<CONNECTION: Connection>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!connectionDone) {
|
if (!connectionDone) {
|
||||||
|
// since this failed, close everything
|
||||||
|
handshakeConnection.subscription.close()
|
||||||
|
handshakeConnection.publication.close()
|
||||||
|
|
||||||
val exception = ClientTimedOutException("Waiting for registration response from server")
|
val exception = ClientTimedOutException("Waiting for registration response from server")
|
||||||
ListenerManager.cleanStackTraceInternal(exception)
|
ListenerManager.cleanStackTraceInternal(exception)
|
||||||
throw exception
|
throw exception
|
||||||
|
Loading…
Reference in New Issue
Block a user