Fix Uninitilized Peer Max Rates.

When called by /libretroshare/src/pqi/pqihandler.cc:140
This commit is contained in:
Phenom 2017-09-11 20:18:06 +02:00
parent 66bf1884a8
commit 8884a324bb
2 changed files with 29 additions and 25 deletions

View File

@ -2088,10 +2088,15 @@ bool p3PeerMgrIMPL::getMaxRates(const RsPeerId& pid,uint32_t& maxUp,uint32_t& ma
std::map<RsPeerId, peerState>::const_iterator it = mFriendList.find(pid) ;
if(it == mFriendList.end())
{
maxUp = 0;
maxDn = 0;
return false ;
}
pgp_id = it->second.gpg_id ;
}
return getMaxRates(pgp_id,maxUp,maxDn) ;
}

View File

@ -136,9 +136,8 @@ int pqihandler::tick()
{
// This is rather inelegant, but pqihandler has searchModules that are dynamically allocated, so the max rates
// need to be updated from inside.
uint32_t maxUp,maxDn ;
rsPeers->getPeerMaximumRates(it->first,maxUp,maxDn);
uint32_t maxUp = 0,maxDn =0 ;
if (rsPeers->getPeerMaximumRates(it->first,maxUp,maxDn) )
it->second->pqi->setRateCap(maxDn,maxUp);// mind the order! Dn first, than Up.
}