public void Initialise(ITorrentManagerInfo torrentData, IReadOnlyList <ReadOnlyBitField> ignoringBitfields)
        {
            TorrentData       = torrentData.TorrentInfo !;
            IgnoringBitfields = ignoringBitfields;
            Temp = new BitField(TorrentData.PieceCount());

            var standardPicker = new StandardPicker();

            HighPriorityPicker = IgnoringPicker.Wrap(new PriorityPicker(standardPicker), ignoringBitfields);

            LowPriorityPicker = new RandomisedPicker(standardPicker);
            LowPriorityPicker = new RarestFirstPicker(LowPriorityPicker);
            LowPriorityPicker = new PriorityPicker(LowPriorityPicker);
            LowPriorityPicker = IgnoringPicker.Wrap(LowPriorityPicker, ignoringBitfields);

            LowPriorityPicker.Initialise(torrentData);
            HighPriorityPicker.Initialise(torrentData);
        }
Ejemplo n.º 2
0
        public void MultiFile()
        {
            picker.Initialise(multiFile);

            Span <BlockInfo> buffer = stackalloc BlockInfo[1];

            picker.PickPiece(multiPeer, multiBitfield, peers, 0, multiBitfield.Length - 1, buffer);
            Assert.AreEqual(1, checker.Picks.Count, "#1");
            Assert.IsTrue(checker.Picks[0].available.AllTrue, "#2");
            Assert.IsTrue(picker.IsInteresting(multiPeer, multiBitfield), "#3");
        }