boolean tooOld = pn.isUnroutableOlderVersion();
if(pn.isConnected() && tooOld) {
// Doesn't count towards the opennet peers limit, so no point dropping it.
continue;
}
NOT_DROP_REASON reason = pn.isDroppableWithReason(false);
if(map != null) {
Integer x = map.get(reason);
if(x == null)
map.put(reason, 1);
else
map.put(reason, x+1);
}
// Over the limit does not force us to drop TOO OLD peers since they don't count towards the limit.
if((reason != NOT_DROP_REASON.DROPPABLE) && ((!force) || tooOld)) {
continue;
}
// LOCKING: Always take the OpennetManager lock first
if(!pn.isConnected()) {
if(logMINOR)
Logger.minor(this, "Possibly dropping opennet peer "+pn+" as is disconnected (reason="+reason+" force="+force+" tooOld="+tooOld);
pn.setWasDropped();
return pn;
}
}
if(noDisconnect) {
if(addingNode && logMINOR) {
Logger.minor(this, "Not disconnecting");
if(map != null)
for(Map.Entry<NOT_DROP_REASON, Integer> entry : map.entrySet()) {
Logger.minor(this, ""+entry.getKey()+" : "+entry.getValue());
}
}
return null;
}
if(map != null) map.clear();
for(OpennetPeerNode pn: peers) {
if(pn == null) continue;
boolean tooOld = pn.isUnroutableOlderVersion();
if(pn.isConnected() && tooOld) {
// Doesn't count anyway.
continue;
}
NOT_DROP_REASON reason = pn.isDroppableWithReason(false);
if(map != null) {
Integer x = map.get(reason);
if(x == null)
map.put(reason, 1);
else