#1959: Leave ping exception logging to plugins

This commit is contained in:
md_5 2018-03-31 10:55:15 +11:00
parent 272258cf5a
commit e690a7b389

View File

@ -122,30 +122,35 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
{ {
if ( ctx.channel().isActive() ) if ( ctx.channel().isActive() )
{ {
if ( cause instanceof ReadTimeoutException ) boolean logExceptions = !( handler instanceof PingHandler );
if ( logExceptions )
{ {
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - read timed out", handler ); if ( cause instanceof ReadTimeoutException )
} else if ( cause instanceof DecoderException && cause.getCause() instanceof BadPacketException )
{
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - bad packet ID, are mods in use!? {1}", new Object[]
{ {
handler, cause.getCause().getMessage() ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - read timed out", handler );
} ); } else if ( cause instanceof DecoderException && cause.getCause() instanceof BadPacketException )
} else if ( cause instanceof DecoderException && cause.getCause() instanceof OverflowPacketException )
{
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - overflow in packet detected! {1}", new Object[]
{ {
handler, cause.getCause().getMessage() ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - bad packet ID, are mods in use!? {1}", new Object[]
} ); {
} else if ( cause instanceof IOException || ( cause instanceof IllegalStateException && handler instanceof InitialHandler ) ) handler, cause.getCause().getMessage()
{ } );
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - {1}: {2}", new Object[] } else if ( cause instanceof DecoderException && cause.getCause() instanceof OverflowPacketException )
{ {
handler, cause.getClass().getSimpleName(), cause.getMessage() ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - overflow in packet detected! {1}", new Object[]
} ); {
} else handler, cause.getCause().getMessage()
{ } );
ProxyServer.getInstance().getLogger().log( Level.SEVERE, handler + " - encountered exception", cause ); } else if ( cause instanceof IOException || ( cause instanceof IllegalStateException && handler instanceof InitialHandler ) )
{
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - {1}: {2}", new Object[]
{
handler, cause.getClass().getSimpleName(), cause.getMessage()
} );
} else
{
ProxyServer.getInstance().getLogger().log( Level.SEVERE, handler + " - encountered exception", cause );
}
} }
if ( handler != null ) if ( handler != null )