Class PeerDatabase
java.lang.Object
com.biglybt.core.peermanager.peerdb.PeerDatabase
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private PeerItem[]
private BloomFilter
private BloomFilter
private long
private long
private final AEMonitor
private static final int
private static final int
private final HashMap
private int
private long
private int
private int
private int
private PeerItem
private final long
private static final int
private static final int
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDiscoveredPeer
(PeerItem peer) Add a potential peer obtained via tracker announce, DHT announce, plugin, etc.protected void
deregisterPeerConnection
(PeerItem base_peer_key) int
PeerItem[]
PeerItem[]
getDiscoveredPeers
(String address) int
private PeerItem[]
int
getNextOptimisticConnectPeer
(boolean non_public) Get the next potential peer for optimistic connect.private PeerItem
getNextOptimisticConnectPeer
(boolean non_public, int recursion_count) private PeerItem
getPeerFromPEX
(long now, boolean starting_up, boolean non_public) Get the peer item that represents ourself.registerPeerConnection
(PeerItem base_peer_item, PeerExchangerItem.Helper helper) Register a new peer connection with the database.void
void
setSelfPeer
(PeerItem self) Mark the given peer as ourself.
-
Field Details
-
STARTUP_MIN_REBUILD_WAIT_TIME
private static final int STARTUP_MIN_REBUILD_WAIT_TIME- See Also:
-
STARTUP_MILLIS
private static final int STARTUP_MILLIS- See Also:
-
MIN_REBUILD_WAIT_TIME
private static final int MIN_REBUILD_WAIT_TIME- See Also:
-
MAX_DISCOVERED_PEERS
private static final int MAX_DISCOVERED_PEERS- See Also:
-
BLOOM_ROTATION_PERIOD
private static final int BLOOM_ROTATION_PERIOD- See Also:
-
BLOOM_FILTER_SIZE
private static final int BLOOM_FILTER_SIZE- See Also:
-
start_time
private final long start_time -
peer_connections
-
discovered_peers
-
discovered_peers_non_pub
-
map_mon
-
cached_peer_popularities
-
popularity_pos
private int popularity_pos -
popularity_pos_non_pub
private int popularity_pos_non_pub -
last_rebuild_time
private long last_rebuild_time -
last_rotation_time
private long last_rotation_time -
self_peer
-
filter_one
-
filter_two
-
pex_count_last_time
private long pex_count_last_time -
pex_count_last
private int pex_count_last -
pex_used_count
private int pex_used_count -
total_peers_returned
private int total_peers_returned
-
-
Constructor Details
-
PeerDatabase
protected PeerDatabase()
-
-
Method Details
-
registerPeerConnection
public PeerExchangerItem registerPeerConnection(PeerItem base_peer_item, PeerExchangerItem.Helper helper) Register a new peer connection with the database.- Parameters:
base_peer_item
- key- Returns:
- registered connection
-
deregisterPeerConnection
-
seedStatusChanged
-
addDiscoveredPeer
Add a potential peer obtained via tracker announce, DHT announce, plugin, etc.- Parameters:
peer
- to add
-
setSelfPeer
Mark the given peer as ourself.- Parameters:
self
- peer
-
getSelfPeer
Get the peer item that represents ourself.- Returns:
- self peer, or null if unknown
-
getDiscoveredPeers
-
getDiscoveredPeers
-
getDiscoveredPeerCount
public int getDiscoveredPeerCount() -
getNextOptimisticConnectPeer
Get the next potential peer for optimistic connect.- Returns:
- peer to connect, or null of no optimistic peer available
-
getNextOptimisticConnectPeer
-
getPeerFromPEX
-
getExchangedPeerCount
public int getExchangedPeerCount() -
getExchangedPeersUsed
public int getExchangedPeersUsed() -
getExchangedPeersSortedByLeastPopularFirst
-
getString
-