public class PeerExchangeRPC extends DispatchHandler
| Modifier and Type | Field and Description |
|---|---|
static int |
SENT_PEERS_CACHE_SIZE |
| Constructor and Description |
|---|
PeerExchangeRPC(PeerBean peerBean,
ConnectionBean connectionBean)
Create a PEX handler that sends message using fire and forget.
|
| Modifier and Type | Method and Description |
|---|---|
void |
handleResponse(Message message,
PeerConnection peerConnection,
boolean sign,
Responder responder)
If the message is OK, that has been previously checked by the user using checkMessage, a reply to the message is
generated here.
|
FutureResponse |
peerExchange(PeerAddress remotePeer,
Number160 locationKey,
Number160 domainKey,
boolean isReplication,
ChannelCreator channelCreator,
ConnectionConfiguration connectionConfiguration)
Peer exchange (PEX) information about other peers from the swarm, to not ask the primary trackers too often.
|
connectionBean, createMessage, createResponseMessage, createResponseMessage, forwardMessage, peerBean, register, signpublic static final int SENT_PEERS_CACHE_SIZE
public PeerExchangeRPC(PeerBean peerBean, ConnectionBean connectionBean)
peerBean - The peer beanconnectionBean - The connection beanpublic FutureResponse peerExchange(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, boolean isReplication, ChannelCreator channelCreator, ConnectionConfiguration connectionConfiguration)
remotePeer - The remote peer to send this requestlocationKey - The location keydomainKey - The domain keyisReplication - Set to true if the PEX is started as replication. This means that this peer learned that an other peer
is closer and sends tracker information to that peer.channelCreator - The channel creator that creates connectionsforceTCP - Set to true if the communication should be TCP, default is UDPpublic void handleResponse(Message message, PeerConnection peerConnection, boolean sign, Responder responder) throws Exception
DispatchHandlerhandleResponse in class DispatchHandlermessage - Request messagesign - Flag to indicate if message is signedException - Any exceptionCopyright © 2014. All rights reserved.