From e96cc09d75cd4b079b454fd4d07f595b6f863a5d Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Fri, 10 Oct 2014 15:21:10 +0000 Subject: [PATCH] Banlist: Remove unused banlist tracking in the profile causing deadlock (ticket #1394) --- router/java/src/net/i2p/router/Banlist.java | 32 +++++++++---------- .../i2p/router/peermanager/PeerProfile.java | 6 ++-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/router/java/src/net/i2p/router/Banlist.java b/router/java/src/net/i2p/router/Banlist.java index d10186d5d1..57f31b2da4 100644 --- a/router/java/src/net/i2p/router/Banlist.java +++ b/router/java/src/net/i2p/router/Banlist.java @@ -83,9 +83,9 @@ public class Banlist { } } catch (IllegalStateException ise) {} // next time... for (Hash peer : _toUnbanlist) { - PeerProfile prof = _context.profileOrganizer().getProfile(peer); - if (prof != null) - prof.unbanlist(); + //PeerProfile prof = _context.profileOrganizer().getProfile(peer); + //if (prof != null) + // prof.unbanlist(); _context.messageHistory().unbanlist(peer); if (_log.shouldLog(Log.INFO)) _log.info("Unbanlisting router (expired) " + peer.toBase64()); @@ -155,11 +155,11 @@ public class Banlist { e.expireOn = _context.clock().now() + BANLIST_DURATION_PARTIAL; } else { long period = BANLIST_DURATION_MS + _context.random().nextLong(BANLIST_DURATION_MS / 4); - PeerProfile prof = _context.profileOrganizer().getProfile(peer); - if (prof != null) { - period = BANLIST_DURATION_MS << prof.incrementBanlists(); - period += _context.random().nextLong(period); - } + //PeerProfile prof = _context.profileOrganizer().getProfile(peer); + //if (prof != null) { + // period = BANLIST_DURATION_MS << prof.incrementBanlists(); + // period += _context.random().nextLong(period); + //} if (period > BANLIST_DURATION_MAX) period = BANLIST_DURATION_MAX; @@ -234,11 +234,11 @@ public class Banlist { } if (fully) { - if (realUnbanlist) { - PeerProfile prof = _context.profileOrganizer().getProfile(peer); - if (prof != null) - prof.unbanlist(); - } + //if (realUnbanlist) { + // PeerProfile prof = _context.profileOrganizer().getProfile(peer); + // if (prof != null) + // prof.unbanlist(); + //} _context.messageHistory().unbanlist(peer); if (_log.shouldLog(Log.INFO) && e != null) _log.info("Unbanlisting router " + peer.toBase64() @@ -266,9 +266,9 @@ public class Banlist { } if (unbanlist) { - PeerProfile prof = _context.profileOrganizer().getProfile(peer); - if (prof != null) - prof.unbanlist(); + //PeerProfile prof = _context.profileOrganizer().getProfile(peer); + //if (prof != null) + // prof.unbanlist(); _context.messageHistory().unbanlist(peer); if (_log.shouldLog(Log.INFO)) _log.info("Unbanlisting router (expired) " + peer.toBase64()); diff --git a/router/java/src/net/i2p/router/peermanager/PeerProfile.java b/router/java/src/net/i2p/router/peermanager/PeerProfile.java index 0ec790c34b..059ac96cbf 100644 --- a/router/java/src/net/i2p/router/peermanager/PeerProfile.java +++ b/router/java/src/net/i2p/router/peermanager/PeerProfile.java @@ -65,7 +65,7 @@ public class PeerProfile { // does this peer profile contain expanded data, or just the basics? private boolean _expanded; private boolean _expandedDB; - private int _consecutiveBanlists; + //private int _consecutiveBanlists; private final int _distance; /** @@ -120,8 +120,8 @@ public class PeerProfile { public boolean getIsExpanded() { return _expanded; } public boolean getIsExpandedDB() { return _expandedDB; } - public int incrementBanlists() { return _consecutiveBanlists++; } - public void unbanlist() { _consecutiveBanlists = 0; } + //public int incrementBanlists() { return _consecutiveBanlists++; } + //public void unbanlist() { _consecutiveBanlists = 0; } /** * Is this peer active at the moment (sending/receiving messages within the last -- GitLab