CORDA-1064 - Fix a hang in AMQP protocol code that occurs when pausing in debugger causes protocol timeout, but wasn't driving event procesing to actuially kill the socket. (#2557) (#2559)

This commit is contained in:
Matthew Nesbit 2018-02-16 17:43:03 +00:00 committed by Katelyn Baker
parent c0448a0e3c
commit 9a339fbac7
2 changed files with 7 additions and 1 deletions

View File

@ -168,12 +168,14 @@ internal class ConnectionStateMachine(serverMode: Boolean,
val transport = event.transport
log.debug { "Transport Head Closed $transport" }
transport.close_tail()
onTransportInternal(transport)
}
override fun onTransportTailClosed(event: Event) {
val transport = event.transport
log.debug { "Transport Tail Closed $transport" }
transport.close_head()
onTransportInternal(transport)
}
override fun onTransportClosed(event: Event) {
@ -195,6 +197,7 @@ internal class ConnectionStateMachine(serverMode: Boolean,
} else {
log.info("Error (no description returned).")
}
onTransportInternal(transport)
}
override fun onTransport(event: Event) {

View File

@ -79,7 +79,10 @@ internal class EventProcessor(channel: Channel,
if ((connection.localState != EndpointState.CLOSED) && !connection.transport.isClosed) {
val now = System.currentTimeMillis()
val tickDelay = Math.max(0L, connection.transport.tick(now) - now)
executor.schedule({ tick(connection) }, tickDelay, TimeUnit.MILLISECONDS)
executor.schedule({
tick(connection)
processEvents()
}, tickDelay, TimeUnit.MILLISECONDS)
}
} catch (ex: Exception) {
connection.transport.close()