📄 peeridentitymanager.java
字号:
// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: PeerIdentityManager.java
package org.gudy.azureus2.core3.peer.util;
import java.util.*;
import org.gudy.azureus2.core3.config.COConfigurationManager;
import org.gudy.azureus2.core3.util.*;
// Referenced classes of package org.gudy.azureus2.core3.peer.util:
// PeerIdentityDataID
public class PeerIdentityManager
{
private static class PeerIdentity
{
private final byte id[];
private final short port;
private final int hashcode;
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj != null && (obj instanceof PeerIdentity))
{
PeerIdentity other = (PeerIdentity)obj;
if (PeerIdentityManager.MUTLI_CONTROLLERS && port != other.port)
return false;
else
return Arrays.equals(id, other.id);
} else
{
return false;
}
}
public int hashCode()
{
return hashcode;
}
protected String getString()
{
return ByteFormatter.encodeString(id);
}
private PeerIdentity(byte _id[], int local_port)
{
id = _id;
port = (short)local_port;
hashcode = (new String(id)).hashCode();
}
}
private static final boolean MUTLI_CONTROLLERS = COConfigurationManager.getBooleanParameter("peer.multiple.controllers.per.torrent.enable", false);
private static final AEMonitor class_mon = new AEMonitor("PeerIdentityManager:class");
private static final Map dataMap = new LightHashMap();
private static int totalIDs = 0;
public PeerIdentityManager()
{
}
public static PeerIdentityDataID createDataID(byte data[])
{
PeerIdentityDataID data_id = new PeerIdentityDataID(data);
Map peerMap;
class_mon.enter();
peerMap = (Map)dataMap.get(data_id);
if (peerMap == null)
{
peerMap = new LightHashMap();
dataMap.put(data_id, peerMap);
}
class_mon.exit();
break MISSING_BLOCK_LABEL_69;
Exception exception;
exception;
class_mon.exit();
throw exception;
data_id.setPeerMap(peerMap);
return data_id;
}
public static boolean addIdentity(PeerIdentityDataID data_id, byte peer_id[], int local_port, String ip)
{
PeerIdentity peerID = new PeerIdentity(peer_id, local_port);
boolean flag;
class_mon.enter();
Map peerMap = (Map)dataMap.get(data_id);
if (peerMap == null)
{
peerMap = new HashMap();
dataMap.put(data_id, peerMap);
}
String old = (String)peerMap.put(peerID, ip);
if (old != null)
break MISSING_BLOCK_LABEL_98;
totalIDs++;
flag = true;
class_mon.exit();
return flag;
flag = false;
class_mon.exit();
return flag;
Exception exception;
exception;
class_mon.exit();
throw exception;
}
public static void removeIdentity(PeerIdentityDataID data_id, byte peer_id[], int local_port)
{
class_mon.enter();
Map peerMap = (Map)dataMap.get(data_id);
if (peerMap != null)
{
PeerIdentity peerID = new PeerIdentity(peer_id, local_port);
String old = (String)peerMap.remove(peerID);
if (old != null)
totalIDs--;
else
Debug.out((new StringBuilder()).append("id not present: id=").append(peerID.getString()).toString());
}
class_mon.exit();
break MISSING_BLOCK_LABEL_110;
Exception exception;
exception;
class_mon.exit();
throw exception;
}
public static boolean containsIdentity(PeerIdentityDataID data_id, byte peer_id[], int local_port)
{
PeerIdentity peerID = new PeerIdentity(peer_id, local_port);
boolean flag;
class_mon.enter();
Map peerMap = (Map)dataMap.get(data_id);
if (peerMap == null || !peerMap.containsKey(peerID))
break MISSING_BLOCK_LABEL_59;
flag = true;
class_mon.exit();
return flag;
class_mon.exit();
break MISSING_BLOCK_LABEL_79;
Exception exception;
exception;
class_mon.exit();
throw exception;
return false;
}
public static int getTotalIdentityCount()
{
return totalIDs;
}
public static int getIdentityCount(PeerIdentityDataID data_id)
{
return data_id.getPeerMap().size();
}
public static boolean containsIPAddress(PeerIdentityDataID data_id, String ip)
{
boolean flag;
class_mon.enter();
Map peerMap = (Map)dataMap.get(data_id);
if (peerMap == null || !peerMap.containsValue(ip))
break MISSING_BLOCK_LABEL_43;
flag = true;
class_mon.exit();
return flag;
class_mon.exit();
break MISSING_BLOCK_LABEL_63;
Exception exception;
exception;
class_mon.exit();
throw exception;
return false;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -