public void AddPacket(Packet packet)
 {
     lock (_Packets) {
         _Packets.Add (packet);
     }
 }
Beispiel #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;
        }
 public PacketTail(Packet packet, double size, PacketTail next)
 {
     _Packet = packet;
     _Size = size;
     _Next = next;
     _Delay = _R.Next (1, 4);
 }