protected override void HandleInterested(InterestedMessage interested, PeerState peer) { base.HandleInterested(interested, peer); peer.IsChoked = false; SendMessage(peer, new UnchokeMessage()); }
protected override void HandlePiece(PieceMessage piece, PeerState peer) { }
protected override void HandleRequest(RequestMessage request, PeerState peer) { }
private void SendBitfield(PeerState peer) { SendMessage(peer, new BitfieldMessage(BlockStrategist.Bitfield)); }
protected virtual bool AddPeer(PeerState peer) { return(Peers.TryAdd(peer.ID, peer)); }
protected override void HandleUnchoke(UnchokeMessage unchoke, PeerState peer) { base.HandleUnchoke(unchoke, peer); SendBlockRequests(peer); }
protected virtual void HandleNotInterested(NotInterestedMessage notInterested, PeerState peer) { peer.IsInterested = false; }
protected virtual void HandleBitfield(BitfieldMessage bitfield, PeerState peer) { bitfield.Bitfield.CopyTo(peer.Bitfield, 0, 0, Metadata.PieceCount); }
protected virtual void HandleInterested(InterestedMessage interested, PeerState peer) { peer.IsInterested = true; }
protected virtual void HandleUnchoke(UnchokeMessage unchoke, PeerState peer) { peer.AmChoked = false; }
protected virtual void HandleChoke(ChokeMessage choke, PeerState peer) { peer.AmChoked = true; }
protected abstract void HandlePiece(PieceMessage piece, PeerState peer);
protected abstract void HandleRequest(RequestMessage request, PeerState peer);