Package com.biglybt.core.peer.util
Class PeerIdentityManager
java.lang.Object
com.biglybt.core.peer.util.PeerIdentityManager
Maintains peer identity information.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final AEMonitor
private static final Map
<PeerIdentityDataID, PeerIdentityManager.DataEntry> private static final boolean
private static int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
addIdentity
(PeerIdentityDataID data_id, byte[] peer_id, int local_port, String ip) Add a new peer identity to the manager.static boolean
containsIdentity
(PeerIdentityDataID data_id, byte[] peer_id, int local_port) Check if the manager already has the given peer identity.static boolean
containsIPAddress
(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 PeerIdentityDataID
createDataID
(byte[] data) static int
getIdentityCount
(PeerIdentityDataID data_id) Get the total number of peer identities managed for the given data item.static int
Get the total number of peer identities managed.static void
removeIdentity
(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
-