use of com.biglybt.core.ipfilter.BannedIp 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();
}
Aggregations