Search in sources :

Example 1 with EnhancedDownloadManager

use of com.biglybt.core.download.EnhancedDownloadManager in project BiglyBT by BiglySoftware.

the class CacheDiscovery method initialise.

public static void initialise(final DownloadManagerEnhancer dme) {
    ip_filter.addListener(new IPFilterListener() {

        @Override
        public void IPFilterEnabledChanged(boolean is_enabled) {
        }

        @Override
        public boolean canIPBeBanned(String ip) {
            return (canBan(ip));
        }

        @Override
        public void IPBanned(BannedIp ip) {
        }

        @Override
        public void IPBlockedListChanged(IpFilter filter) {
        }

        @Override
        public boolean canIPBeBlocked(String ip, byte[] torrent_hash) {
            EnhancedDownloadManager dm = dme.getEnhancedDownload(torrent_hash);
            if (dm == null) {
                return (true);
            }
            return (true);
        }
    });
    new AEThread2("CacheDiscovery:ban checker", true) {

        @Override
        public void run() {
            BannedIp[] bans = ip_filter.getBannedIps();
            for (int i = 0; i < bans.length; i++) {
                String ip = bans[i].getIp();
                if (!canBan(ip)) {
                    ip_filter.unban(ip);
                }
            }
        }
    }.start();
}
Also used : IpFilter(com.biglybt.core.ipfilter.IpFilter) BannedIp(com.biglybt.core.ipfilter.BannedIp) IPFilterListener(com.biglybt.core.ipfilter.IPFilterListener) EnhancedDownloadManager(com.biglybt.core.download.EnhancedDownloadManager)

Aggregations

EnhancedDownloadManager (com.biglybt.core.download.EnhancedDownloadManager)1 BannedIp (com.biglybt.core.ipfilter.BannedIp)1 IPFilterListener (com.biglybt.core.ipfilter.IPFilterListener)1 IpFilter (com.biglybt.core.ipfilter.IpFilter)1