Search in sources :

Example 16 with HashWrapper

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);
    }
}
Also used : HashWrapper(com.biglybt.core.util.HashWrapper)

Example 17 with HashWrapper

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);
    }
}
Also used : GlobalManager(com.biglybt.core.global.GlobalManager) HashWrapper(com.biglybt.core.util.HashWrapper) DownloadManager(com.biglybt.core.download.DownloadManager)

Aggregations

HashWrapper (com.biglybt.core.util.HashWrapper)17 DownloadManager (com.biglybt.core.download.DownloadManager)5 GlobalManager (com.biglybt.core.global.GlobalManager)4 DHTTransportContact (com.biglybt.core.dht.transport.DHTTransportContact)2 PEPeerManager (com.biglybt.core.peer.PEPeerManager)2 PEPiece (com.biglybt.core.peer.PEPiece)2 UIFunctions (com.biglybt.ui.UIFunctions)2 ActivitiesEntry (com.biglybt.activities.ActivitiesEntry)1 Core (com.biglybt.core.Core)1 ParameterListener (com.biglybt.core.config.ParameterListener)1 TranscodeFile (com.biglybt.core.devices.TranscodeFile)1 TranscodeJob (com.biglybt.core.devices.TranscodeJob)1 DownloadManagerState (com.biglybt.core.download.DownloadManagerState)1 DownloadHistory (com.biglybt.core.history.DownloadHistory)1 PEPeer (com.biglybt.core.peer.PEPeer)1 TagDownload (com.biglybt.core.tag.TagDownload)1 TOTorrent (com.biglybt.core.torrent.TOTorrent)1 TOTorrentException (com.biglybt.core.torrent.TOTorrentException)1 TRTrackerScraperClientResolver (com.biglybt.core.tracker.client.TRTrackerScraperClientResolver)1 IdentityHashSet (com.biglybt.core.util.IdentityHashSet)1