mirror of
https://github.com/corda/corda.git
synced 2025-06-14 05:08:18 +00:00
ENT-2116: handle amqp client remote error, added test (#3636)
* ENT-2116: handle amqp client remote error, added test * ENT: 2116 rename test, added logging * ENT-2116: rename test to indicate its purpose
This commit is contained in:
@ -66,6 +66,8 @@ internal class ConnectionStateMachine(private val serverMode: Boolean,
|
||||
|
||||
private fun logInfoWithMDC(msg: String) = withMDC { log.info(msg) }
|
||||
|
||||
private fun logWarnWithMDC(msg: String, ex: Throwable? = null) = withMDC { log.warn(msg, ex) }
|
||||
|
||||
private fun logErrorWithMDC(msg: String, ex: Throwable? = null) = withMDC { log.error(msg, ex) }
|
||||
|
||||
val connection: Connection
|
||||
@ -308,6 +310,16 @@ internal class ConnectionStateMachine(private val serverMode: Boolean,
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLinkRemoteClose(e: Event) {
|
||||
val link = e.link
|
||||
if(link.remoteCondition != null) {
|
||||
logWarnWithMDC("Connection closed due to error on remote side: `${link.remoteCondition.description}`")
|
||||
transport.condition = link.condition
|
||||
transport.close_tail()
|
||||
transport.pop(Math.max(0, transport.pending())) // Force generation of TRANSPORT_HEAD_CLOSE (not in C code)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLinkFinal(event: Event) {
|
||||
val link = event.link
|
||||
if (link is Sender) {
|
||||
|
Reference in New Issue
Block a user