netty client: log closed address

This commit is contained in:
Moritz Zwerger 2023-10-08 15:26:29 +02:00
parent b028e8f913
commit 5af4c70ae5
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -50,6 +50,7 @@ import javax.crypto.Cipher
class NettyClient(
val connection: Connection,
) : SimpleChannelInboundHandler<Any>(), ClientNetwork {
private var address: ServerAddress? = null
override var connected by observed(false)
private set
override var state by observed(ProtocolStates.HANDSHAKE)
@ -92,6 +93,7 @@ class NettyClient(
}
override fun connect(address: ServerAddress, native: Boolean) {
this.address = address
state = ProtocolStates.HANDSHAKE
val natives = if (native) TransportNatives.get() else NioNatives
val bootstrap = Bootstrap()
@ -162,7 +164,7 @@ class NettyClient(
}
override fun channelInactive(context: ChannelHandlerContext) {
Log.log(LogMessageType.NETWORK, LogLevels.VERBOSE) { "Connection closed" }
Log.log(LogMessageType.NETWORK, LogLevels.VERBOSE) { "Connection closed ($address)" }
connected = false
}