fixed bug in grouter which caused sending of messages to some offline peers, hence wasting some routes, and causing " p3ServiceServer::sendItem() Fails Filtering for packet id=2001810" messages.

This commit is contained in:
csoler 2016-04-05 18:09:02 -04:00
parent 7817a542f2
commit f26348b710

View File

@ -1141,24 +1141,30 @@ void p3GRouter::locked_collectAvailableFriends(const GRouterKeyId& gxs_id,const
for(uint32_t i=0;i<tmp_peers.size();++i)
if(incoming_routes.find(tmp_peers[i]) != incoming_routes.end())
{
{
#ifdef GROUTER_DEBUG
std::cerr << " removing " << tmp_peers[i] << " which is an incoming route" << std::endl;
#endif
}
}
else if(online_ids.find(tmp_peers[i]) == online_ids.end())
{
#ifdef GROUTER_DEBUG
std::cerr << " removing " << tmp_peers[i] << " because it is offline now!" << std::endl;
#endif
}
else if(probas[i] < RS_GROUTER_PROBABILITY_THRESHOLD_BEST_PEERS_SELECT*max_probability)
{
{
#ifdef GROUTER_DEBUG
std::cerr << " removing " << tmp_peers[i] << " because probability is below best peers threshold" << std::endl;
#endif
}
}
else
{
{
tmp_peers[count] = tmp_peers[i] ;
probas[count] = (max_probability==0.0)? (0.5+0.001*RSRandom::random_f32()) : probas[i] ;
++count ;
}
++count ;
}
tmp_peers.resize(count) ;
probas.resize(count) ;