forked from I2P_Developers/i2p.i2p
Merge branch 'i2p.i2p.2.4.0-reverse-api-change' into 'master'
Router: Reverse API change from banlistRouterHard back to BanlistRouterForever See merge request i2p-hackers/i2p.i2p!131
This commit is contained in:
@ -658,7 +658,7 @@ class NewsFetcher extends UpdateRunner {
|
||||
}
|
||||
Hash h = Hash.create(b);
|
||||
if (!ban.isBanlistedHard(h)) {
|
||||
ban.banlistRouterHard(h, reason);
|
||||
ban.banlistRouterForever(h, reason);
|
||||
_context.commSystem().forceDisconnect(h);
|
||||
}
|
||||
} else {
|
||||
|
@ -21,7 +21,7 @@ public class ConfigPeerHandler extends FormHandler {
|
||||
} else if (_action.equals(_t("Ban peer until restart"))) {
|
||||
Hash h = getHash();
|
||||
if (h != null) {
|
||||
_context.banlist().banlistRouterHard(h, _t("Manually banned via {0}"), "<a href=\"configpeer\">configpeer</a>");
|
||||
_context.banlist().banlistRouterForever(h, _t("Manually banned via {0}"), "<a href=\"configpeer\">configpeer</a>");
|
||||
_context.commSystem().forceDisconnect(h);
|
||||
addFormNotice(_t("Peer") + " " + _peer + " " + _t("banned until restart") );
|
||||
return;
|
||||
|
@ -72,7 +72,7 @@ public class Banlist {
|
||||
_entries = new ConcurrentHashMap<Hash, Entry>(16);
|
||||
_context.jobQueue().addJob(new Cleanup(_context));
|
||||
// i2pd bug?
|
||||
banlistRouterHard(Hash.FAKE_HASH, "Invalid Hash");
|
||||
banlistRouterForever(Hash.FAKE_HASH, "Invalid Hash");
|
||||
}
|
||||
|
||||
private class Cleanup extends JobImpl {
|
||||
@ -149,14 +149,14 @@ public class Banlist {
|
||||
/**
|
||||
* @return true if it WAS previously on the list
|
||||
*/
|
||||
public boolean banlistRouterHard(Hash peer, String reason) {
|
||||
public boolean banlistRouterForever(Hash peer, String reason) {
|
||||
return banlistRouter(peer, reason, null, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if it WAS previously on the list
|
||||
*/
|
||||
public boolean banlistRouterHard(Hash peer, String reason, String reasonComment) {
|
||||
public boolean banlistRouterForever(Hash peer, String reason, String reasonComment) {
|
||||
return banlistRouter(peer, reason, reasonComment, null, true);
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ public class Blocklist {
|
||||
_context.banlist().BANLIST_CODE_HARD, null,
|
||||
_context.clock().now() + expireInterval());
|
||||
else
|
||||
_context.banlist().banlistRouterHard(peer, reason, comment);
|
||||
_context.banlist().banlistRouterForever(peer, reason, comment);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1287,7 +1287,7 @@ public class Blocklist {
|
||||
_context.banlist().BANLIST_CODE_HARD, null,
|
||||
System.currentTimeMillis()+expireInterval());
|
||||
else
|
||||
_context.banlist().banlistRouterHard(peer, reason, reasonComment);
|
||||
_context.banlist().banlistRouterForever(peer, reason, reasonComment);
|
||||
}
|
||||
private synchronized void banlistRouter(Hash peer, List<byte[]> ips, long duration) {
|
||||
// This only checks one file for now, pick the best one
|
||||
|
@ -376,7 +376,7 @@ class FloodfillVerifyStoreJob extends JobImpl {
|
||||
if (_log.shouldWarn())
|
||||
_log.warn(getJobId() + ": Sent bad data for verify: " + _target);
|
||||
pm.dbLookupFailed(_target);
|
||||
ctx.banlist().banlistRouterHard(_target, "Sent bad netdb data");
|
||||
ctx.banlist().banlistRouterForever(_target, "Sent bad netdb data");
|
||||
ctx.statManager().addRateData("netDb.floodfillVerifyFail", delay);
|
||||
resend();
|
||||
return;
|
||||
|
@ -1248,7 +1248,7 @@ public abstract class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacad
|
||||
// old i2pd bug, possibly at startup, don't ban forever
|
||||
_context.banlist().banlistRouter(key, "No network specified", null, null, _context.clock().now() + Banlist.BANLIST_DURATION_NO_NETWORK);
|
||||
} else {
|
||||
_context.banlist().banlistRouterHard(key, "Not in our network: " + id);
|
||||
_context.banlist().banlistRouterForever(key, "Not in our network: " + id);
|
||||
}
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Not in our network: " + routerInfo, new Exception());
|
||||
@ -1454,7 +1454,7 @@ public abstract class KademliaNetworkDatabaseFacade extends NetworkDatabaseFacad
|
||||
SigType type = kc.getSigType();
|
||||
if (type == null || !type.isAvailable()) {
|
||||
String stype = (type != null) ? type.toString() : Integer.toString(kc.getSigTypeCode());
|
||||
_context.banlist().banlistRouterHard(h, "Unsupported signature type " + stype);
|
||||
_context.banlist().banlistRouterForever(h, "Unsupported signature type " + stype);
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Unsupported sig type " + stype + " for router " + h);
|
||||
throw new UnsupportedCryptoException("Sig type " + stype);
|
||||
|
@ -178,7 +178,7 @@ class LoadRouterInfoJob extends JobImpl {
|
||||
File f = PersistentDataStore.getRouterInfoFile(getContext(), h);
|
||||
f.delete();
|
||||
// the banlist can be called at any time
|
||||
getContext().banlist().banlistRouterHard(h, "Our previous identity");
|
||||
getContext().banlist().banlistRouterForever(h, "Our previous identity");
|
||||
_us = null;
|
||||
}
|
||||
if (sigTypeChanged)
|
||||
|
@ -758,7 +758,7 @@ public class GeoIP {
|
||||
for (Hash h : ctx.netDb().getAllRouters()) {
|
||||
String hisCountry = ctx.commSystem().getCountry(h);
|
||||
if (country.equals(hisCountry)) {
|
||||
ctx.banlist().banlistRouterHard(h, "In our country");
|
||||
ctx.banlist().banlistRouterForever(h, "In our country");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -928,7 +928,7 @@ public class TransportManager implements TransportEventListener {
|
||||
if (msg.getTarget().getIdentity().getSigningPublicKey().getType() == null) {
|
||||
// we don't support his crypto
|
||||
_context.statManager().addRateData("transport.banlistOnUnsupportedSigType", 1);
|
||||
_context.banlist().banlistRouterHard(peer, _x("Unsupported signature type"));
|
||||
_context.banlist().banlistRouterForever(peer, _x("Unsupported signature type"));
|
||||
} else if (unreachableTransports >= _transports.size() && countActivePeers() > 0) {
|
||||
// Don't banlist if we aren't talking to anybody, as we may have a network connection issue
|
||||
// TODO if we are IPv6 only, ban for longer
|
||||
|
@ -548,7 +548,7 @@ public class NTCPTransport extends TransportImpl {
|
||||
if (nid == -1)
|
||||
_context.banlist().banlistRouter(peer, "No network specified", null, null, _context.clock().now() + Banlist.BANLIST_DURATION_NO_NETWORK);
|
||||
else
|
||||
_context.banlist().banlistRouterHard(peer, "Not in our network: " + nid);
|
||||
_context.banlist().banlistRouterForever(peer, "Not in our network: " + nid);
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Not in our network: " + toAddress, new Exception());
|
||||
markUnreachable(peer);
|
||||
|
@ -330,7 +330,7 @@ class EstablishmentManager {
|
||||
if (id == -1)
|
||||
_context.banlist().banlistRouter(toHash, "No network specified", null, null, _context.clock().now() + Banlist.BANLIST_DURATION_NO_NETWORK);
|
||||
else
|
||||
_context.banlist().banlistRouterHard(toHash, "Not in our network: " + id);
|
||||
_context.banlist().banlistRouterForever(toHash, "Not in our network: " + id);
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Not in our network: " + toRouterInfo, new Exception());
|
||||
_transport.markUnreachable(toHash);
|
||||
|
@ -394,7 +394,7 @@ class InboundEstablishState {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Unsupported sig type from: " + toString());
|
||||
// _x() in UDPTransport
|
||||
_context.banlist().banlistRouterHard(_receivedUnconfirmedIdentity.calculateHash(),
|
||||
_context.banlist().banlistRouterForever(_receivedUnconfirmedIdentity.calculateHash(),
|
||||
"Unsupported signature type");
|
||||
fail();
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ class MessageReceiver {
|
||||
// distinct port of buggy router
|
||||
_transport.sendDestroy(ps, SSU2Util.REASON_BANNED);
|
||||
_transport.dropPeer(ps, true, "Corrupt DSM");
|
||||
_context.banlist().banlistRouterHard(state.getFrom(),
|
||||
_context.banlist().banlistRouterForever(state.getFrom(),
|
||||
"Sent corrupt message"); // don't bother translating
|
||||
}
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ class PacketHandler {
|
||||
_transport.dropPeer(state, true, "Clock skew");
|
||||
if (state.getRemotePort() == 65520) {
|
||||
// distinct port of buggy router
|
||||
_context.banlist().banlistRouterHard(state.getRemotePeer(),
|
||||
_context.banlist().banlistRouterForever(state.getRemotePeer(),
|
||||
_x("Excessive clock skew: {0}"),
|
||||
DataHelper.formatDuration(skew));
|
||||
} else {
|
||||
@ -660,7 +660,7 @@ class PacketHandler {
|
||||
_transport.dropPeer(state, true, "Clock skew");
|
||||
if (state.getRemotePort() == 65520) {
|
||||
// distinct port of buggy router
|
||||
_context.banlist().banlistRouterHard(state.getRemotePeer(),
|
||||
_context.banlist().banlistRouterForever(state.getRemotePeer(),
|
||||
_x("Excessive clock skew: {0}"),
|
||||
DataHelper.formatDuration(0 - skew));
|
||||
} else {
|
||||
|
@ -2083,7 +2083,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
if (id == -1)
|
||||
_context.banlist().banlistRouter(peerHash, "No network specified", null, null, _context.clock().now() + Banlist.BANLIST_DURATION_NO_NETWORK);
|
||||
else
|
||||
_context.banlist().banlistRouterHard(peerHash, "Not in our network: " + id);
|
||||
_context.banlist().banlistRouterForever(peerHash, "Not in our network: " + id);
|
||||
if (peer != null)
|
||||
sendDestroy(peer, SSU2Util.REASON_NETID);
|
||||
dropPeer(peerHash, false, "Not in our network");
|
||||
@ -2471,7 +2471,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
|
||||
if (nid == -1)
|
||||
_context.banlist().banlistRouter(to, "No network specified", null, null, _context.clock().now() + Banlist.BANLIST_DURATION_NO_NETWORK);
|
||||
else
|
||||
_context.banlist().banlistRouterHard(to, "Not in our network: " + nid);
|
||||
_context.banlist().banlistRouterForever(to, "Not in our network: " + nid);
|
||||
markUnreachable(to);
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user