public virtual void CancelRequests() { var messages = new List <PieceRequest>(); peer.IsChoking = false; peer.BitField.SetAll(true); PieceRequest m; while ((m = picker.PickPiece(peer, peers)) != null) { messages.Add(m); } picker.PickPiece(peer, peers); Assert.AreEqual(rig.TotalBlocks, messages.Count, "#0"); picker.CancelRequests(peer); var messages2 = new List <PieceRequest>(); while ((m = picker.PickPiece(peer, peers)) != null) { messages2.Add(m); } Assert.AreEqual(messages.Count, messages2.Count, "#1"); for (int i = 0; i < messages.Count; i++) { Assert.IsTrue(messages2.Contains(messages[i])); } }
public virtual void CancelRequests(PeerId peer) { CheckOverriden(); picker.CancelRequests(peer); }
public virtual void CancelRequests(IPieceRequester peer) { CheckOverriden(); picker.CancelRequests(peer); }