Clone FML packet indexes if channel is not open. Fixes potential threading issue.

This commit is contained in:
LexManos 2016-01-14 13:35:19 -08:00
parent dad870ea0b
commit 7b92a27908
2 changed files with 12 additions and 1 deletions

View file

@ -238,7 +238,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
manager.closeChannel(new ChatComponentText("Handshake Complete review log file for details."));
scm.initializeConnectionToPlayer(manager, player, serverHandler);
}
@Override
protected void channelRead0(ChannelHandlerContext ctx, Packet msg) throws Exception
{
@ -430,6 +430,8 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
public void sendProxy(FMLProxyPacket msg)
{
if (!manager.isChannelOpen())
msg = msg.copy();
manager.sendPacket(msg);
}

View file

@ -186,4 +186,13 @@ public class FMLProxyPacket implements Packet<INetHandler> {
{
return target;
}
public FMLProxyPacket copy()
{
FMLProxyPacket pkt = new FMLProxyPacket(new PacketBuffer(payload.duplicate()), channel);
pkt.dispatcher = dispatcher;
pkt.netHandler = netHandler;
pkt.target = target;
return pkt;
}
}