## 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 with type parameters of type Peer
`(package private) Queue<Peer>` `PeerCoordinator.peers` synchronize on this when changing peers or downloaders.

Methods in org.klomp.snark that return types with arguments of type Peer
`List<Peer>` `Snark.getPeerList()`
`Set<Peer>` `TrackerInfo.getPeers()`
`List<Peer>` `PeerCoordinator.peerList()`

Methods in org.klomp.snark with parameters of type Peer
`boolean` `Piece.addPeer(Peer peer)` caller must synchronize
`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.
`PartialPiece` `PeerCoordinator.getPartialPiece(Peer peer, BitField havePieces)` Return partial piece to the PeerState if it's still wanted and peer has it.
`PartialPiece` `PeerListener.getPartialPiece(Peer peer, BitField havePieces)` Called when a peer has connected and there may be a partially downloaded piece that the coordinatorator can give the peer task
`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)` this does nothing but logging
`void` `PeerListener.gotChoke(Peer peer, boolean choke)` Called when a choke message is received.
`void` `PeerCoordinator.gotExtension(Peer peer, int id, byte[] bs)` PeerListener callback
`void` `PeerListener.gotExtension(Peer peer, int id, byte[] bs)` Called when an extension message is received.
`boolean` `PeerCoordinator.gotHave(Peer peer, int piece)`
`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.
`void` `PeerCoordinator.gotPeers(Peer peer, List<PeerID> peers)` PeerListener callback
`void` `PeerListener.gotPeers(Peer peer, List<PeerID> pIDList)` Called when peers are received via PEX
`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.
`void` `PeerCoordinator.gotPort(Peer peer, int port)` PeerListener callback Tell the DHT to ping it, this will get back the node info
`void` `PeerListener.gotPort(Peer peer, int port)` Called when a port message is received.
`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.
`static void` `ExtensionHandler.handleMessage(Peer peer, PeerListener listener, int id, byte[] bs)`
`boolean` `Piece.isRequestedBy(Peer peer)` Is peer requesting this piece? Caller must synchronize
`boolean` `PeerCoordinator.needPiece(Peer peer, BitField havePieces)` Called when we are downloading from the peer and may need to ask for a new piece.
`boolean` `PeerListener.needPiece(Peer peer, BitField bitfield)` Called when we are downloading from the peer and may need to ask for a new piece.
`void` `Snark.peerChange(PeerCoordinator coordinator, Peer peer)` CoordinatorListener - this does nothing
`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)` caller must synchronize
`void` `PeerCoordinator.removePeerFromPieces(Peer peer)` Called when a peer is removed, to prevent it from being used in rarest-first calculations.
`void` `PeerCoordinator.savePartialPieces(Peer peer, List<PartialPiece> partials)` Save partial pieces on peer disconnection and hopefully restart it later.
`void` `PeerListener.savePartialPieces(Peer peer, List<PartialPiece> pcs)` Called when the peer has disconnected and the peer task may have a partially downloaded piece that the PeerCoordinator can save
`(package private) void` `PeerCoordinator.sendPeers(Peer peer)` Send a PEX message to the peer, if he supports PEX.
`static void` `ExtensionHandler.sendPEX(Peer peer, List<Peer> pList)` added.f and dropped unsupported
`void` `Piece.setRequested(Peer peer, boolean requested)` Since 0.8.3, keep track of who is requesting here, to avoid deadlocks from querying each peer.
`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.

Method parameters in org.klomp.snark with type arguments of type Peer
`static void` `ExtensionHandler.sendPEX(Peer peer, List<Peer> pList)` added.f and dropped unsupported

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