mirror of
https://gitlab.com/Monsterovich/lanemu.git
synced 2024-07-07 06:01:16 +02:00
Ignore adding blocked peer in doPeerChecks
This commit is contained in:
parent
130f0a99b1
commit
cb609712e9
|
@ -479,9 +479,7 @@ public class DHT implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
if (!ipAdded) {
|
||||
doPeerChecks(remotePeer, addr);
|
||||
|
||||
if (!ipAdded && doPeerChecks(remotePeer, addr)) {
|
||||
connectionManager.getConnector().addIP(addr.getAddress(),
|
||||
addr.getPort(), null, "BitTorrent DHT", "", false);
|
||||
}
|
||||
|
@ -507,8 +505,12 @@ public class DHT implements Runnable {
|
|||
*
|
||||
* @param remotePeer The Contact information.
|
||||
* @param address The InetSocketAddress sent by this contact.
|
||||
*
|
||||
* @return false if the peer was blocked, otherwise returns true
|
||||
*/
|
||||
private void doPeerChecks(Contact remotePeer, InetSocketAddress address) {
|
||||
private boolean doPeerChecks(Contact remotePeer, InetSocketAddress address) {
|
||||
boolean result = true;
|
||||
|
||||
if (maliciousPeerCounts.size() > SUSPICIOUS_PEERS_MAX) {
|
||||
maliciousPeerCounts.clear();
|
||||
maliciousPeerAddresses.clear();
|
||||
|
@ -526,6 +528,8 @@ public class DHT implements Runnable {
|
|||
maliciousPeers.add(remotePeer);
|
||||
maliciousPeerCounts.remove(remotePeer);
|
||||
|
||||
result = false;
|
||||
|
||||
Vector<InetSocketAddress> addrToRemove = new Vector<InetSocketAddress>();
|
||||
for (InetSocketAddress maliciousPeerAddr : maliciousPeerAddresses.keySet()) {
|
||||
if (maliciousPeerAddresses.get(maliciousPeerAddr).equals(remotePeer)) {
|
||||
|
@ -553,6 +557,8 @@ public class DHT implements Runnable {
|
|||
|
||||
lastRemotePeer = remotePeer;
|
||||
lastAddress = address;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue