use of com.biglybt.core.util.HashWrapper in project BiglyBT by BiglySoftware.
the class TRTrackerServerPeerImpl method importPeer.
public static TRTrackerServerPeerImpl importPeer(Map map) {
try {
HashWrapper peer_id = new HashWrapper((byte[]) map.get("peer_id"));
int key_hash_code = ((Long) map.get("key_hash_code")).intValue();
byte[] ip = (byte[]) map.get("ip");
boolean ip_override = ((Long) map.get("ip_override")).intValue() == 1;
short tcp_port = ((Long) map.get("tcp_port")).shortValue();
short udp_port = ((Long) map.get("udp_port")).shortValue();
short http_port = ((Long) map.get("http_port")).shortValue();
byte crypto_level = ((Long) map.get("crypto_level")).byteValue();
byte az_ver = ((Long) map.get("az_ver")).byteValue();
String ip_str = new String((byte[]) map.get("ip_str"));
byte[] ip_bytes = (byte[]) map.get("ip_bytes");
byte NAT_status = ((Long) map.get("NAT_status")).byteValue();
long timeout = ((Long) map.get("timeout")).longValue();
long uploaded = ((Long) map.get("uploaded")).longValue();
long downloaded = ((Long) map.get("downloaded")).longValue();
long amount_left = ((Long) map.get("amount_left")).longValue();
long last_contact_time = ((Long) map.get("last_contact_time")).longValue();
boolean download_completed = ((Long) map.get("download_completed")).intValue() == 1;
boolean biased = ((Long) map.get("biased")).intValue() == 1;
short up_speed = ((Long) map.get("up_speed")).shortValue();
return (new TRTrackerServerPeerImpl(peer_id, key_hash_code, ip, ip_override, tcp_port, udp_port, http_port, crypto_level, az_ver, ip_str, ip_bytes, NAT_status, timeout, uploaded, downloaded, amount_left, last_contact_time, download_completed, biased, up_speed));
} catch (Throwable e) {
return (null);
}
}
use of com.biglybt.core.util.HashWrapper in project BiglyBT by BiglySoftware.
the class ClientIDPlugin method getProperty.
@Override
public Object getProperty(byte[] hash, String property_name) {
if (property_name == ClientIDGenerator.PR_CLIENT_NAME) {
try {
GlobalManager gm = core.getGlobalManager();
DownloadManager dm = gm.getDownloadManager(new HashWrapper(hash));
if (dm != null && gm.isSwarmMerging(dm)) {
return (BIGLYBT_CLIENT_NAME_SM);
}
} catch (Throwable e) {
}
return (BIGLYBT_CLIENT_NAME);
} else if (property_name == ClientIDGenerator.PR_MESSAGING_MODE) {
return (BTHandshake.AZ_RESERVED_MODE);
} else {
return (null);
}
}
Aggregations