mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 01:16:20 -05:00
Merge pull request #1027 from PhenomRetroShare/Fix_UninitializedPeerMaxRates
Fix Uninitilized Peer Max Rates.
This commit is contained in:
commit
762d0258ed
@ -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) ;
|
std::map<RsPeerId, peerState>::const_iterator it = mFriendList.find(pid) ;
|
||||||
|
|
||||||
if(it == mFriendList.end())
|
if(it == mFriendList.end())
|
||||||
|
{
|
||||||
|
maxUp = 0;
|
||||||
|
maxDn = 0;
|
||||||
return false ;
|
return false ;
|
||||||
|
}
|
||||||
|
|
||||||
pgp_id = it->second.gpg_id ;
|
pgp_id = it->second.gpg_id ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getMaxRates(pgp_id,maxUp,maxDn) ;
|
return getMaxRates(pgp_id,maxUp,maxDn) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,9 +136,8 @@ int pqihandler::tick()
|
|||||||
{
|
{
|
||||||
// This is rather inelegant, but pqihandler has searchModules that are dynamically allocated, so the max rates
|
// This is rather inelegant, but pqihandler has searchModules that are dynamically allocated, so the max rates
|
||||||
// need to be updated from inside.
|
// need to be updated from inside.
|
||||||
uint32_t maxUp,maxDn ;
|
uint32_t maxUp = 0,maxDn =0 ;
|
||||||
rsPeers->getPeerMaximumRates(it->first,maxUp,maxDn);
|
if (rsPeers->getPeerMaximumRates(it->first,maxUp,maxDn) )
|
||||||
|
|
||||||
it->second->pqi->setRateCap(maxDn,maxUp);// mind the order! Dn first, than Up.
|
it->second->pqi->setRateCap(maxDn,maxUp);// mind the order! Dn first, than Up.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user