Interface PEPeerListener

All Known Implementing Classes:
PiecePickerImpl.PEPeerListenerImpl

public interface PEPeerListener
Listener for peer events.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAvailability(PEPeer peer, BitFlags peerHavePieces)
    The peer asserts that their availability should be added to the torrent-global availability pool The peer must send when, and only when, their availability is known but not after going to CLOSING state.
    void
    removeAvailability(PEPeer peer, BitFlags peerHavePieces)
    The peer asserts that their availability must now be taken from the torrent-global availability pool The peer must send this only after having sent a corresponding addAvailability message, and must not send it in a state prior to CLOSING state.
    void
    sentBadChunk(PEPeer peer, int piece_num, int total_bad_chunks)
    The peer has sent us a bad piece data chunk.
    void
    stateChanged(PEPeer peer, int new_state)
    The peer has changed to the given state.
  • Method Details

    • stateChanged

      void stateChanged(PEPeer peer, int new_state)
      The peer has changed to the given state.
      Parameters:
      peer - the peer the message is about
      new_state - of peer
    • sentBadChunk

      void sentBadChunk(PEPeer peer, int piece_num, int total_bad_chunks)
      The peer has sent us a bad piece data chunk.
      Parameters:
      peer - the peer the message is about
      piece_num - piece that failed hash check
      total_bad_chunks - total number of bad chunks sent by this peer so far
    • addAvailability

      void addAvailability(PEPeer peer, BitFlags peerHavePieces)
      The peer asserts that their availability should be added to the torrent-global availability pool The peer must send when, and only when, their availability is known but not after going to CLOSING state. Upon sending this message, the peer must remember it was sent, and then later send a corresponding removeAvailability message
      Parameters:
      peer - the message is about
      peerHavePieces - BitFlags of pieces availabile
    • removeAvailability

      void removeAvailability(PEPeer peer, BitFlags peerHavePieces)
      The peer asserts that their availability must now be taken from the torrent-global availability pool The peer must send this only after having sent a corresponding addAvailability message, and must not send it in a state prior to CLOSING state. The BitFlags must be complete, with all pieces from any Bitfield message as well as those from any Have messages.
      Parameters:
      peer - the message is about
      peerHavePieces - BitFlags of pieces no longer available