public void AddPacket(Packet packet)
 {
     lock (_Packets) {
         _Packets.Add (packet);
     }
 }
示例#2
0
        public bool RequestPiece(int index, Node target)
        {
            if (!HasPiece (index)) {
                return false;
            }

            if (_StepsUntilReadyToSend > 0) {
                return false;
            }

            _StepsUntilReadyToSend = _SendInterval;

            Packet p = new Packet (this, target, index);
            _NodeManager.AddPacket (p);

            return true;
        }
示例#3
0
 public PacketTail(Packet packet, double size, PacketTail next)
 {
     _Packet = packet;
     _Size = size;
     _Next = next;
     _Delay = _R.Next (1, 4);
 }