Don't log full CorruptedFrameException

This commit is contained in:
md_5 2020-01-29 10:47:03 +11:00
parent d3bd785289
commit e9ba95b9dc

View File

@ -3,6 +3,7 @@ package net.md_5.bungee.netty;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.handler.codec.CorruptedFrameException;
import io.netty.handler.codec.DecoderException; import io.netty.handler.codec.DecoderException;
import io.netty.handler.codec.haproxy.HAProxyMessage; import io.netty.handler.codec.haproxy.HAProxyMessage;
import io.netty.handler.timeout.ReadTimeoutException; import io.netty.handler.timeout.ReadTimeoutException;
@ -130,18 +131,27 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
if ( cause instanceof ReadTimeoutException ) if ( cause instanceof ReadTimeoutException )
{ {
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - read timed out", handler ); 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 )
{ {
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - bad packet ID, are mods in use!? {1}", new Object[] if ( cause instanceof CorruptedFrameException )
{ {
handler, cause.getCause().getMessage() ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - corrupted frame: {1}", new Object[]
} ); {
} else if ( cause instanceof DecoderException && cause.getCause() instanceof OverflowPacketException ) handler, cause.getMessage()
{ } );
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - overflow in packet detected! {1}", new Object[] } else if ( cause.getCause() instanceof BadPacketException )
{ {
handler, cause.getCause().getMessage() ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - bad packet ID, are mods in use!? {1}", new Object[]
} ); {
handler, cause.getCause().getMessage()
} );
} else if ( cause.getCause() instanceof OverflowPacketException )
{
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - overflow in packet detected! {1}", new Object[]
{
handler, cause.getCause().getMessage()
} );
}
} else if ( cause instanceof IOException || ( cause instanceof IllegalStateException && handler instanceof InitialHandler ) ) } else if ( cause instanceof IOException || ( cause instanceof IllegalStateException && handler instanceof InitialHandler ) )
{ {
ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - {1}: {2}", new Object[] ProxyServer.getInstance().getLogger().log( Level.WARNING, "{0} - {1}: {2}", new Object[]