Dequeue() private method

private Dequeue ( ) : PeerMessage
return Universal.Torrent.Client.Messages.PeerMessage
        /// <summary>
        ///     Checks the send queue of the peer to see if there are any outstanding pieces which they requested
        ///     and rejects them as necessary
        /// </summary>
        /// <param name="peer"></param>
        private void RejectPendingRequests(PeerId peer)
        {
            var length = peer.QueueLength;

            for (var i = 0; i < length; i++)
            {
                var message = peer.Dequeue();
                if (!(message is PieceMessage))
                {
                    peer.Enqueue(message);
                    continue;
                }

                var pieceMessage = (PieceMessage) message;

                // If the peer doesn't support fast peer, then we will never requeue the message
                if (!(peer.SupportsFastPeer && ClientEngine.SupportsFastPeer))
                {
                    peer.IsRequestingPiecesCount--;
                    continue;
                }

                // If the peer supports fast peer, queue the message if it is an AllowedFast piece
                // Otherwise send a reject message for the piece
                if (peer.AmAllowedFastPieces.Contains(pieceMessage.PieceIndex))
                    peer.Enqueue(pieceMessage);
                else
                {
                    peer.IsRequestingPiecesCount--;
                    peer.Enqueue(new RejectRequestMessage(pieceMessage));
                }
            }
        }