Class PeerIdentityManager
java.lang.Object
com.biglybt.core.peer.util.PeerIdentityManager
Maintains peer identity information.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final AEMonitorprivate static final Map<PeerIdentityDataID, PeerIdentityManager.DataEntry> private static final booleanprivate static int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanaddIdentity(PeerIdentityDataID data_id, byte[] peer_id, int local_port, String ip) Add a new peer identity to the manager.static booleancontainsIdentity(PeerIdentityDataID data_id, byte[] peer_id, int local_port) Check if the manager already has the given peer identity.static booleancontainsIPAddress(PeerIdentityDataID data_id, String ip) Check if the given IP address is already present in the manager's peer identity list for the given data item (i.e.static PeerIdentityDataIDcreateDataID(byte[] data) static intgetIdentityCount(PeerIdentityDataID data_id) Get the total number of peer identities managed for the given data item.static intGet the total number of peer identities managed.static voidremoveIdentity(PeerIdentityDataID data_id, byte[] peer_id, int local_port) Remove a peer identity from the manager.
-
Field Details
-
MUTLI_CONTROLLERS
private static final boolean MUTLI_CONTROLLERS -
class_mon
-
dataMap
-
totalIDs
private static volatile int totalIDs
-
-
Constructor Details
-
PeerIdentityManager
public PeerIdentityManager()
-
-
Method Details
-
createDataID
-
addIdentity
public static boolean addIdentity(PeerIdentityDataID data_id, byte[] peer_id, int local_port, String ip) Add a new peer identity to the manager.- Parameters:
data_id- unique id for the data item associated with this connectionpeer_id- unique id for this peer connectionip- remote peer's ip address
-
removeIdentity
Remove a peer identity from the manager.- Parameters:
data_id- id for the data item associated with this connectionpeer_id- id for this peer connection
-
containsIdentity
Check if the manager already has the given peer identity.- Parameters:
data_id- id for the data item associated with this connectionpeer_id- id for this peer connection- Returns:
- true if the peer identity is found, false if not found
-
getTotalIdentityCount
public static int getTotalIdentityCount()Get the total number of peer identities managed.- Returns:
- total number of peers over all data items
-
getIdentityCount
Get the total number of peer identities managed for the given data item.- Parameters:
data_id- data item to count over- Returns:
- total number of peers for this data item
-
containsIPAddress
Check if the given IP address is already present in the manager's peer identity list for the given data item (i.e. check if there is already a peer with that IP address).- Parameters:
data_id- id for the data item associated with this connectionip- IP address to check for- Returns:
- true if the IP is found, false if not found
-