hide multiple exceptions under carpet

This commit is contained in:
creeper123123321 2021-03-13 17:42:45 -03:00
parent 7971d3c8e4
commit 4de94027d1
2 changed files with 5 additions and 1 deletions

View File

@ -15,6 +15,7 @@ class MinecraftHandler(
) : SimpleChannelInboundHandler<Packet>() { ) : SimpleChannelInboundHandler<Packet>() {
lateinit var remoteAddress: SocketAddress lateinit var remoteAddress: SocketAddress
val other: Channel? get() = if (frontEnd) data.backChannel else data.frontChannel val other: Channel? get() = if (frontEnd) data.backChannel else data.frontChannel
var msgDisconnected = false
override fun channelRead0(ctx: ChannelHandlerContext, packet: Packet) { override fun channelRead0(ctx: ChannelHandlerContext, packet: Packet) {
if (ctx.channel().isActive) { if (ctx.channel().isActive) {

View File

@ -14,8 +14,11 @@ interface MinecraftConnectionState {
) )
fun disconnect(handler: MinecraftHandler, msg: String) { fun disconnect(handler: MinecraftHandler, msg: String) {
if (!handler.msgDisconnected) {
handler.msgDisconnected = true
mcLogger.info("DC ${handler.remoteAddress}: $msg") mcLogger.info("DC ${handler.remoteAddress}: $msg")
} }
}
fun onInactivated(handler: MinecraftHandler) { fun onInactivated(handler: MinecraftHandler) {
mcLogger.info("- ${handler.remoteAddress}") mcLogger.info("- ${handler.remoteAddress}")