Fix race condition when using indexed codec in a LAN server. Fixes spurious crash when LAN server is running.

This commit is contained in:
cpw 2016-02-20 16:04:31 -05:00
parent c88bc769ef
commit 3e4107a222
2 changed files with 2 additions and 2 deletions

View file

@ -69,7 +69,7 @@ public abstract class FMLIndexedMessageToMessageCodec<A> extends MessageToMessag
protected final void decode(ChannelHandlerContext ctx, FMLProxyPacket msg, List<Object> out) throws Exception protected final void decode(ChannelHandlerContext ctx, FMLProxyPacket msg, List<Object> out) throws Exception
{ {
testMessageValidity(msg); testMessageValidity(msg);
ByteBuf payload = msg.payload().copy(); ByteBuf payload = msg.payload().duplicate();
if (payload.readableBytes() < 1) 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()); 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());

View file

@ -133,7 +133,7 @@ public class FMLProxyPacket implements Packet<INetHandler> {
if (data.length < PART_SIZE) if (data.length < PART_SIZE)
{ {
ret.add(new S3FPacketCustomPayload(channel, payload)); ret.add(new S3FPacketCustomPayload(channel, new PacketBuffer(payload.duplicate())));
} }
else else
{ {