OctoTorrent.Client.RandomisedPicker.PickPiece C# (CSharp) Method

PickPiece() public method

public PickPiece ( PeerId id, BitField peerBitfield, List otherPeers, int count, int startIndex, int endIndex ) : MessageBundle
id PeerId
peerBitfield BitField
otherPeers List
count int
startIndex int
endIndex int
return OctoTorrent.Client.Messages.MessageBundle
        public override MessageBundle PickPiece(PeerId id, BitField peerBitfield, List<PeerId> otherPeers, int count, int startIndex, int endIndex)
        {
            if (peerBitfield.AllFalse)
                return null;

            if (count > 1)
                return base.PickPiece(id, peerBitfield, otherPeers, count, startIndex, endIndex);

            int midpoint = random.Next(startIndex, endIndex);
            return base.PickPiece(id, peerBitfield, otherPeers, count, midpoint, endIndex) ??
                   base.PickPiece(id, peerBitfield, otherPeers, count, startIndex, midpoint);
        }