if( currTime<lastPingRemoval+ TIME_BETWEEN_BAD_PING_REMOVALS){
return false;
}
double highestLongTermPing=0.0;
SpeedManagerPingSource highestSource=null;
double lowestLongTermPing=10000.0;
int len = sources.length;
for(int i=0; i<len; i++){
PingSourceStats pss = (PingSourceStats) pingAverages.get(sources[i]);
if ( pss == null ){
continue;
}
Average a = pss.getLongTermAve();
double avePingTime = a.getAverage();
//is this a new highest value?
if( avePingTime>highestLongTermPing ){
highestLongTermPing = avePingTime;
highestSource = sources[i];
}
//is this a new lowest value?
if( avePingTime<lowestLongTermPing ){
lowestLongTermPing = avePingTime;
}
}//for
boolean removedSource = false;
//if the highest value is 8x the lowest then find another source.
if( lowestLongTermPing*8 < highestLongTermPing ){
//remove the slow source we will get a new one to replace it.
if( highestSource!=null ){
SpeedManagerLogger.log("dropping ping source: "+highestSource.getAddress()+" for being 8x greater then min source.");
highestSource.destroy();
removedSource = true;
resetTimer();
}
}//if