Skip to content

Commit

Permalink
Router: Add a minimum threshold for banning a router which repeatedly…
Browse files Browse the repository at this point in the history
… disrespects our congestion flags
  • Loading branch information
eyedeekay committed Jul 19, 2023
1 parent 10022fb commit 728762d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions router/java/src/net/i2p/router/tunnel/pool/BuildHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,14 @@ private long handleRequest(BuildMessageState state, long now) {
// congestion flags
if (fromVersion != null){
if (VersionComparator.comp(fromVersion, MIN_VERSION_HONOR_CAPS) >= 0) {
if (_log.shouldLog(Log.WARN))
_log.warn("Banning peer: " + fromRI.getHash() + " due to it disrespecting our congestion flags");
_context.banlist().banlistRouter(from, "disrespected our tunnel flags", null, false);
_context.statManager().addRateData("tunnel.dropTunnelFromVersion"+from, 1);
long knocks = _context.statManager().getRate("tunnel.dropTunnelFromVersion"+from).getLifetimeEventCount();
if (knocks > 10) {
if (_log.shouldLog(Log.WARN))
_log.warn("Banning peer: " + fromRI.getHash() + " due to it disrespecting our congestion flags");
_context.banlist().banlistRouter(from, "disrespected our tunnel flags", null, false);
}
}

}
}
return -1;
Expand Down

0 comments on commit 728762d

Please sign in to comment.