minor optimization

This commit is contained in:
zzz
2013-10-31 21:08:02 +00:00
parent 0010581405
commit fa70d439c3

View File

@@ -1403,37 +1403,38 @@ public class ProfileOrganizer {
* *
*/ */
private void locked_placeProfile(PeerProfile profile) { private void locked_placeProfile(PeerProfile profile) {
Hash peer = profile.getPeer();
if (profile.getIsFailing()) { if (profile.getIsFailing()) {
if (!shouldDrop(profile)) if (!shouldDrop(profile))
_failingPeers.put(profile.getPeer(), profile); _failingPeers.put(peer, profile);
_fastPeers.remove(profile.getPeer()); _fastPeers.remove(peer);
_highCapacityPeers.remove(profile.getPeer()); _highCapacityPeers.remove(peer);
_wellIntegratedPeers.remove(profile.getPeer()); _wellIntegratedPeers.remove(peer);
_notFailingPeers.remove(profile.getPeer()); _notFailingPeers.remove(peer);
_notFailingPeersList.remove(profile.getPeer()); _notFailingPeersList.remove(peer);
} else { } else {
_failingPeers.remove(profile.getPeer()); _failingPeers.remove(peer);
_fastPeers.remove(profile.getPeer()); _fastPeers.remove(peer);
_highCapacityPeers.remove(profile.getPeer()); _highCapacityPeers.remove(peer);
_wellIntegratedPeers.remove(profile.getPeer()); _wellIntegratedPeers.remove(peer);
_notFailingPeers.put(profile.getPeer(), profile); _notFailingPeers.put(peer, profile);
_notFailingPeersList.add(profile.getPeer()); _notFailingPeersList.add(peer);
// if not selectable for a tunnel (banlisted for example), // if not selectable for a tunnel (banlisted for example),
// don't allow them in the high-cap pool, what would the point of that be? // don't allow them in the high-cap pool, what would the point of that be?
if (_thresholdCapacityValue <= profile.getCapacityValue() && if (_thresholdCapacityValue <= profile.getCapacityValue() &&
isSelectable(profile.getPeer())) { isSelectable(peer)) {
_highCapacityPeers.put(profile.getPeer(), profile); _highCapacityPeers.put(peer, profile);
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("High capacity: \t" + profile.getPeer().toBase64()); _log.debug("High capacity: \t" + peer);
if (_thresholdSpeedValue <= profile.getSpeedValue()) { if (_thresholdSpeedValue <= profile.getSpeedValue()) {
if (!profile.getIsActive()) { if (!profile.getIsActive()) {
if (_log.shouldLog(Log.INFO)) if (_log.shouldLog(Log.INFO))
_log.info("Skipping fast mark [!active] for " + profile.getPeer().toBase64()); _log.info("Skipping fast mark [!active] for " + peer);
} else { } else {
_fastPeers.put(profile.getPeer(), profile); _fastPeers.put(peer, profile);
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Fast: \t" + profile.getPeer().toBase64()); _log.debug("Fast: \t" + peer);
} }
} }
@@ -1446,9 +1447,9 @@ public class ProfileOrganizer {
// to call him well-integrated. // to call him well-integrated.
// This could be used later to see if a floodfill peer is for real. // This could be used later to see if a floodfill peer is for real.
if (_thresholdIntegrationValue <= profile.getIntegrationValue()) { if (_thresholdIntegrationValue <= profile.getIntegrationValue()) {
_wellIntegratedPeers.put(profile.getPeer(), profile); _wellIntegratedPeers.put(peer, profile);
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Integrated: \t" + profile.getPeer().toBase64()); _log.debug("Integrated: \t" + peer);
} }
} }
} }