print disconnect message of InitialHandlers

This commit is contained in:
Outfluencer 2023-12-20 15:47:36 +01:00 committed by GitHub
parent 8537709045
commit 46fddc4110
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 2 deletions

View File

@ -60,9 +60,22 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
channel.markClosed();
handler.disconnected( channel );
if ( !( handler instanceof InitialHandler || handler instanceof PingHandler ) )
if ( !( handler instanceof PingHandler ) )
{
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has disconnected", handler );
if ( handler instanceof InitialHandler )
{
InitialHandler initialHandler = (InitialHandler) handler;
if ( initialHandler.getDisconnectMessage() != null )
{
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has disconnected: {1}", new Object[]
{
handler, initialHandler.getDisconnectMessage().toPlainText()
} );
}
} else
{
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has disconnected", handler );
}
}
}
}