Log when it's likely the indexedcodec is gonna fail, because of LAN server derps likely. Try and give some context for debuggers.

This commit is contained in:
cpw 2016-02-19 23:18:16 -05:00
parent 34382745ab
commit c88bc769ef

View file

@ -70,6 +70,10 @@ public abstract class FMLIndexedMessageToMessageCodec<A> extends MessageToMessag
{ {
testMessageValidity(msg); testMessageValidity(msg);
ByteBuf payload = msg.payload().copy(); ByteBuf payload = msg.payload().copy();
if (payload.readableBytes() < 1)
{
FMLLog.log(Level.ERROR, "The FMLIndexedCodec has received an empty buffer on channel %s, likely a result of a LAN server issue. Pipeline parts : %s", ctx.channel().attr(NetworkRegistry.FML_CHANNEL), ctx.pipeline().toString());
}
byte discriminator = payload.readByte(); byte discriminator = payload.readByte();
Class<? extends A> clazz = discriminators.get(discriminator); Class<? extends A> clazz = discriminators.get(discriminator);
if(clazz == null) if(clazz == null)