From 4de94027d1de27270017ff867c29adc6aae103e3 Mon Sep 17 00:00:00 2001 From: creeper123123321 <7974274+creeper123123321@users.noreply.github.com> Date: Sat, 13 Mar 2021 17:42:45 -0300 Subject: [PATCH] hide multiple exceptions under carpet --- .../creeper123123321/viaaas/handler/MinecraftHandler.kt | 1 + .../viaaas/handler/state/MinecraftConnectionState.kt | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/github/creeper123123321/viaaas/handler/MinecraftHandler.kt b/src/main/kotlin/com/github/creeper123123321/viaaas/handler/MinecraftHandler.kt index af43fe0..9f5a17e 100644 --- a/src/main/kotlin/com/github/creeper123123321/viaaas/handler/MinecraftHandler.kt +++ b/src/main/kotlin/com/github/creeper123123321/viaaas/handler/MinecraftHandler.kt @@ -15,6 +15,7 @@ class MinecraftHandler( ) : SimpleChannelInboundHandler() { lateinit var remoteAddress: SocketAddress val other: Channel? get() = if (frontEnd) data.backChannel else data.frontChannel + var msgDisconnected = false override fun channelRead0(ctx: ChannelHandlerContext, packet: Packet) { if (ctx.channel().isActive) { diff --git a/src/main/kotlin/com/github/creeper123123321/viaaas/handler/state/MinecraftConnectionState.kt b/src/main/kotlin/com/github/creeper123123321/viaaas/handler/state/MinecraftConnectionState.kt index 96a25e3..7575fc7 100644 --- a/src/main/kotlin/com/github/creeper123123321/viaaas/handler/state/MinecraftConnectionState.kt +++ b/src/main/kotlin/com/github/creeper123123321/viaaas/handler/state/MinecraftConnectionState.kt @@ -14,7 +14,10 @@ interface MinecraftConnectionState { ) fun disconnect(handler: MinecraftHandler, msg: String) { - mcLogger.info("DC ${handler.remoteAddress}: $msg") + if (!handler.msgDisconnected) { + handler.msgDisconnected = true + mcLogger.info("DC ${handler.remoteAddress}: $msg") + } } fun onInactivated(handler: MinecraftHandler) {