Class PiecePickerImpl.PEPeerListenerImpl

  • All Implemented Interfaces:
    PEPeerListener
    Enclosing class:
    PiecePickerImpl

    private class PiecePickerImpl.PEPeerListenerImpl
    extends java.lang.Object
    implements PEPeerListener
    An instance of this listener is registered with each peer
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private PEPeerListenerImpl()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      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)
      Takes away the given pieces from global availability
      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 newState)
      The peer has changed to the given state.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PEPeerListenerImpl

        private PEPeerListenerImpl()
    • Method Detail

      • stateChanged

        public final void stateChanged​(PEPeer peer,
                                       int newState)
        Description copied from interface: PEPeerListener
        The peer has changed to the given state.
        Specified by:
        stateChanged in interface PEPeerListener
        Parameters:
        peer - the peer the message is about
        newState - of peer
      • sentBadChunk

        public final void sentBadChunk​(PEPeer peer,
                                       int piece_num,
                                       int total_bad_chunks)
        Description copied from interface: PEPeerListener
        The peer has sent us a bad piece data chunk.
        Specified by:
        sentBadChunk in interface PEPeerListener
        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

        public final void addAvailability​(PEPeer peer,
                                          BitFlags peerHavePieces)
        Description copied from interface: PEPeerListener
        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
        Specified by:
        addAvailability in interface PEPeerListener
        Parameters:
        peer - the message is about
        peerHavePieces - BitFlags of pieces availabile
      • removeAvailability

        public final void removeAvailability​(PEPeer peer,
                                             BitFlags peerHavePieces)
        Takes away the given pieces from global availability
        Specified by:
        removeAvailability in interface PEPeerListener
        Parameters:
        PEPeer - peer this is about
        peerHasPieces - BitFlags of the pieces