Banlist: Remove unused banlist tracking in the profile causing deadlock (ticket #1394)

This commit is contained in:
zzz
2014-10-10 15:21:10 +00:00
parent d87178fec3
commit e96cc09d75
2 changed files with 19 additions and 19 deletions

View File

@ -83,9 +83,9 @@ public class Banlist {
} }
} catch (IllegalStateException ise) {} // next time... } catch (IllegalStateException ise) {} // next time...
for (Hash peer : _toUnbanlist) { for (Hash peer : _toUnbanlist) {
PeerProfile prof = _context.profileOrganizer().getProfile(peer); //PeerProfile prof = _context.profileOrganizer().getProfile(peer);
if (prof != null) //if (prof != null)
prof.unbanlist(); // prof.unbanlist();
_context.messageHistory().unbanlist(peer); _context.messageHistory().unbanlist(peer);
if (_log.shouldLog(Log.INFO)) if (_log.shouldLog(Log.INFO))
_log.info("Unbanlisting router (expired) " + peer.toBase64()); _log.info("Unbanlisting router (expired) " + peer.toBase64());
@ -155,11 +155,11 @@ public class Banlist {
e.expireOn = _context.clock().now() + BANLIST_DURATION_PARTIAL; e.expireOn = _context.clock().now() + BANLIST_DURATION_PARTIAL;
} else { } else {
long period = BANLIST_DURATION_MS + _context.random().nextLong(BANLIST_DURATION_MS / 4); long period = BANLIST_DURATION_MS + _context.random().nextLong(BANLIST_DURATION_MS / 4);
PeerProfile prof = _context.profileOrganizer().getProfile(peer); //PeerProfile prof = _context.profileOrganizer().getProfile(peer);
if (prof != null) { //if (prof != null) {
period = BANLIST_DURATION_MS << prof.incrementBanlists(); // period = BANLIST_DURATION_MS << prof.incrementBanlists();
period += _context.random().nextLong(period); // period += _context.random().nextLong(period);
} //}
if (period > BANLIST_DURATION_MAX) if (period > BANLIST_DURATION_MAX)
period = BANLIST_DURATION_MAX; period = BANLIST_DURATION_MAX;
@ -234,11 +234,11 @@ public class Banlist {
} }
if (fully) { if (fully) {
if (realUnbanlist) { //if (realUnbanlist) {
PeerProfile prof = _context.profileOrganizer().getProfile(peer); // PeerProfile prof = _context.profileOrganizer().getProfile(peer);
if (prof != null) // if (prof != null)
prof.unbanlist(); // prof.unbanlist();
} //}
_context.messageHistory().unbanlist(peer); _context.messageHistory().unbanlist(peer);
if (_log.shouldLog(Log.INFO) && e != null) if (_log.shouldLog(Log.INFO) && e != null)
_log.info("Unbanlisting router " + peer.toBase64() _log.info("Unbanlisting router " + peer.toBase64()
@ -266,9 +266,9 @@ public class Banlist {
} }
if (unbanlist) { if (unbanlist) {
PeerProfile prof = _context.profileOrganizer().getProfile(peer); //PeerProfile prof = _context.profileOrganizer().getProfile(peer);
if (prof != null) //if (prof != null)
prof.unbanlist(); // prof.unbanlist();
_context.messageHistory().unbanlist(peer); _context.messageHistory().unbanlist(peer);
if (_log.shouldLog(Log.INFO)) if (_log.shouldLog(Log.INFO))
_log.info("Unbanlisting router (expired) " + peer.toBase64()); _log.info("Unbanlisting router (expired) " + peer.toBase64());

View File

@ -65,7 +65,7 @@ public class PeerProfile {
// does this peer profile contain expanded data, or just the basics? // does this peer profile contain expanded data, or just the basics?
private boolean _expanded; private boolean _expanded;
private boolean _expandedDB; private boolean _expandedDB;
private int _consecutiveBanlists; //private int _consecutiveBanlists;
private final int _distance; private final int _distance;
/** /**
@ -120,8 +120,8 @@ public class PeerProfile {
public boolean getIsExpanded() { return _expanded; } public boolean getIsExpanded() { return _expanded; }
public boolean getIsExpandedDB() { return _expandedDB; } public boolean getIsExpandedDB() { return _expandedDB; }
public int incrementBanlists() { return _consecutiveBanlists++; } //public int incrementBanlists() { return _consecutiveBanlists++; }
public void unbanlist() { _consecutiveBanlists = 0; } //public void unbanlist() { _consecutiveBanlists = 0; }
/** /**
* Is this peer active at the moment (sending/receiving messages within the last * Is this peer active at the moment (sending/receiving messages within the last