Universal.Torrent.Client.PeerConnections.PeerId.EnqueueAt C# (CSharp) Method

EnqueueAt() private method

private EnqueueAt ( PeerMessage message, int index ) : void
message Universal.Torrent.Client.Messages.PeerMessage
index int
return void
        internal void EnqueueAt(PeerMessage message, int index)
        {
            if (_sendQueue.Count == 0 || index >= _sendQueue.Count)
                Enqueue(message);
            else
                _sendQueue.Insert(index, message);
        }

Usage Example

        public void Unchoke(PeerId peerToUnchoke)
        {
            //Unchoke the supplied peer

            if (!peerToUnchoke.AmChoking)
                //We're already unchoking this peer, nothing to do
                return;

            peerToUnchoke.AmChoking = false;
            _owningTorrent.UploadingTo++;
            peerToUnchoke.EnqueueAt(new UnchokeMessage(), 0);
            peerToUnchoke.LastUnchoked = DateTime.Now;
            peerToUnchoke.FirstReviewPeriod = true;
            Debug.WriteLine(peerToUnchoke.Connection, "Unchoking");
            //			Send2Log("Unchoking: " + PeerToUnchoke.Location);
        }
All Usage Examples Of Universal.Torrent.Client.PeerConnections.PeerId::EnqueueAt