public static List<FMLProxyPacket> forwardHandshake(CompleteHandshake push, NetworkDispatcher target, Side side) { channelPair.get(side).attr(NetworkDispatcher.FML_DISPATCHER).set(target); channelPair.get(side).writeOutbound(push); ArrayList<FMLProxyPacket> list = new ArrayList<FMLProxyPacket>(); for (Object o: channelPair.get(side).outboundMessages()) { list.add((FMLProxyPacket)o); } channelPair.get(side).outboundMessages().clear(); return list; }
@Override protected void channelRead0(ChannelHandlerContext ctx, CompleteHandshake msg) throws Exception { // Cauldron start - attempt to fix race condition with attr being null Object attr = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER); if (attr != null) { NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).getAndRemove(); dispatcher.completeHandshake(msg.target); } // Cauldron end }
@Override protected void channelRead0(ChannelHandlerContext ctx, CompleteHandshake msg) throws Exception { NetworkDispatcher dispatcher = ctx.channel().attr(NetworkDispatcher.FML_DISPATCHER).getAndRemove(); dispatcher.completeHandshake(msg.target); }