## Uses of Class
org.klomp.snark.Peer

Packages that use Peer
org.klomp.snark

Uses of Peer in org.klomp.snark

Fields in org.klomp.snark declared as Peer
`(package private) Peer` `PeerState.peer`

Methods in org.klomp.snark with parameters of type Peer
`boolean` `Piece.addPeer(Peer peer)`
`boolean` `PeerCoordinator.addPeer(Peer peer)`
`void` `PeerCoordinator.connected(Peer peer)`
`void` `PeerListener.connected(Peer peer)` Called when the connection to the peer has started and the handshake was successfull.
`void` `PeerCoordinator.disconnected(Peer peer)`
`void` `PeerListener.disconnected(Peer peer)` Called when the connection to the peer was terminated or the connection handshake failed.
`void` `PeerCoordinator.downloaded(Peer peer, int size)` Called when a peer has downloaded some bytes of a piece.
`void` `PeerListener.downloaded(Peer peer, int size)` Called when a (partial) piece has been downloaded from the peer.
`boolean` `PeerCoordinator.gotBitField(Peer peer, BitField bitfield)` Returns true if the given bitfield contains at least one piece we are interested in.
`boolean` `PeerListener.gotBitField(Peer peer, BitField bitfield)` Called when a bitmap message is received.
`void` `PeerCoordinator.gotChoke(Peer peer, boolean choke)`
`void` `PeerListener.gotChoke(Peer peer, boolean choke)` Called when a choke message is received.
`boolean` `PeerCoordinator.gotHave(Peer peer, int piece)` Returns true if we don't have the given piece yet.
`boolean` `PeerListener.gotHave(Peer peer, int piece)` Called when a have piece message is received.
`void` `PeerCoordinator.gotInterest(Peer peer, boolean interest)`
`void` `PeerListener.gotInterest(Peer peer, boolean interest)` Called when an interested message is received.
`boolean` `PeerCoordinator.gotPiece(Peer peer, int piece, byte[] bs)` Returns false if the piece is no good (according to the hash).
`boolean` `PeerListener.gotPiece(Peer peer, int piece, byte[] bs)` Called when a piece is received from the peer.
`byte[]` `PeerCoordinator.gotRequest(Peer peer, int piece, int off, int len)` Returns a byte array containing the requested piece or null of the piece is unknown.
`byte[]` `PeerListener.gotRequest(Peer peer, int piece, int off, int len)` Called when the peer wants (part of) a piece from us.
`void` `PeerCoordinator.markUnrequested(Peer peer)` Mark a peer's requested pieces unrequested when it is disconnected Once for each piece This is enough trouble, maybe would be easier just to regenerate the requested list from scratch instead.
`void` `PeerListener.markUnrequested(Peer peer)` Mark a peer's requested pieces unrequested when it is disconnected This prevents premature end game
`void` `Snark.peerChange(PeerCoordinator coordinator, Peer peer)` coordinatorListener
`void` `CoordinatorListener.peerChange(PeerCoordinator coordinator, Peer peer)` Called when the PeerCoordinator notices a change in the state of a peer.
`boolean` `Piece.removePeer(Peer peer)`
`void` `PeerCoordinator.removePeerFromPieces(Peer peer)` Called when a peer is removed, to prevent it from being used in rarest-first calculations.
`void` `PeerCoordinator.uploaded(Peer peer, int size)` Called when a peer has uploaded some bytes of a piece.
`void` `PeerListener.uploaded(Peer peer, int size)` Called when a (partial) piece has been uploaded to the peer.
`int` `PeerCoordinator.wantPiece(Peer peer, BitField havePieces)` Returns one of pieces in the given BitField that is still wanted or -1 if none of the given pieces are wanted.
`int` `PeerListener.wantPiece(Peer peer, BitField bitfield)` Called when we are downloading from the peer and need to ask for a new piece.

Constructors in org.klomp.snark with parameters of type Peer
`PeerConnectionIn(Peer peer, java.io.DataInputStream din)`
`PeerConnectionOut(Peer peer, java.io.DataOutputStream dout)`
`PeerState(Peer peer, PeerListener listener, MetaInfo metainfo, PeerConnectionIn in, PeerConnectionOut out)`