OctoTorrent.Client.ChokeUnchokeManager.ReallocateSlot C# (CSharp) Method

ReallocateSlot() private method

Reallocates the next slot with the specified peer if we can
private ReallocateSlot ( int &NumberOfSlots, int &MaximumUnchokes, PeerId peer ) : void
NumberOfSlots int
MaximumUnchokes int
peer PeerId
return void
        private void ReallocateSlot(ref int NumberOfSlots, ref int MaximumUnchokes, PeerId peer)
        {
            if (!peer.AmChoking)
            {
                //This peer is already unchoked, just decrement the number of slots
                NumberOfSlots--;
                //				Send2Log("Leave: " + peer.Location);
            }
            else if (MaximumUnchokes > 0)
            {
                //This peer is choked and we've not yet reached the limit of unchokes, unchoke it
                Unchoke(peer);
                MaximumUnchokes--;
                NumberOfSlots--;
            }
        }