Exemple #1
0
 private void add(Packet packet, ulong id)
 {
     if (idMap.ContainsKey(id))
     {
         idMap[id].data.packet = packet;
         idMap[id].InternalTickList.Clear();
         idMap[id].ClientAckIds.Clear();
     }
     else
     {
         PendingData <PacketWithId> pendingData = new PendingData <PacketWithId>(new PacketWithId(packet, id));
         pending.Add(pendingData);
     }
 }
 private void add(Packet packet, ushort opcode)
 {
     if (opcodeMap.ContainsKey(opcode))
     {
         opcodeMap[opcode].data.packet = packet;
         opcodeMap[opcode].InternalTickList.Clear();
         opcodeMap[opcode].ClientAckIds.Clear();
     }
     else
     {
         PendingData <PacketWithOpcode> pendingData = new PendingData <PacketWithOpcode>(new PacketWithOpcode(packet, opcode));
         pending.Add(pendingData);
     }
 }
Exemple #3
0
        public void ack(ushort blockId)
        {
            List <PendingData <T> > toFind = new List <PendingData <T> >();

            for (int i = pending.Count - 1; i >= 0; --i)
            {
                PendingData <T> p = pending[i];

                foreach (ushort s in p.ClientAckIds)
                {
                    if (s == blockId)
                    {
                        toFind.Add(p);
                        pending.RemoveAt(i);
                        break;
                    }
                }
            }

            onAck(toFind);
        }