mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
fixed bug in setting MaxRate values
This commit is contained in:
parent
f5ad8b49be
commit
83a143476e
5 changed files with 17 additions and 54 deletions
|
@ -2116,18 +2116,15 @@ bool p3PeerMgrIMPL::setMaxRates(const RsPgpId& pid,uint32_t maxUp,uint32_t maxDn
|
|||
{
|
||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||
|
||||
std::map<RsPgpId, PeerBandwidthLimits>::iterator it = mPeerBandwidthLimits.find(pid) ;
|
||||
PeerBandwidthLimits& p(mPeerBandwidthLimits[pid]) ;
|
||||
|
||||
if(mPeerBandwidthLimits.end() == it)
|
||||
return false ;
|
||||
|
||||
if(maxUp == it->second.max_up_rate_kbs && maxDn == it->second.max_dl_rate_kbs)
|
||||
if(maxUp == p.max_up_rate_kbs && maxDn == p.max_dl_rate_kbs)
|
||||
return true ;
|
||||
|
||||
std::cerr << "Updating max rates for peer " << pid << " to " << maxUp << " kB/s (up), " << maxDn << " kB/s (dn)" << std::endl;
|
||||
|
||||
it->second.max_up_rate_kbs = maxUp ;
|
||||
it->second.max_dl_rate_kbs = maxDn ;
|
||||
p.max_up_rate_kbs = maxUp ;
|
||||
p.max_dl_rate_kbs = maxDn ;
|
||||
|
||||
IndicateConfigChanged();
|
||||
|
||||
|
|
|
@ -209,9 +209,9 @@ virtual uint32_t getHiddenType(const RsPeerId &ssl_id) = 0;
|
|||
|
||||
|
||||
virtual int getFriendCount(bool ssl, bool online) = 0;
|
||||
virtual bool setMaxRates(const RsPgpId& pid,uint32_t maxR,uint32_t minR)=0;
|
||||
virtual bool getMaxRates(const RsPgpId& pid,uint32_t& maxR,uint32_t& minR)=0;
|
||||
virtual bool getMaxRates(const RsPeerId& pid,uint32_t& maxR,uint32_t& minR)=0;
|
||||
virtual bool setMaxRates(const RsPgpId& pid,uint32_t maxUp,uint32_t maxDn)=0;
|
||||
virtual bool getMaxRates(const RsPgpId& pid,uint32_t& maxUp,uint32_t& maxDn)=0;
|
||||
virtual bool getMaxRates(const RsPeerId& pid,uint32_t& maxUp,uint32_t& maxDn)=0;
|
||||
|
||||
/************* DEPRECIATED FUNCTIONS (TO REMOVE) ********/
|
||||
|
||||
|
@ -326,9 +326,9 @@ virtual int getFriendCount(bool ssl, bool online);
|
|||
// Single Use Function... shouldn't be here. used by p3serverconfig.cc
|
||||
virtual bool haveOnceConnected();
|
||||
|
||||
virtual bool setMaxRates(const RsPgpId& pid,uint32_t maxR,uint32_t minR);
|
||||
virtual bool getMaxRates(const RsPgpId& pid,uint32_t& maxR,uint32_t& minR);
|
||||
virtual bool getMaxRates(const RsPeerId& pid,uint32_t& maxR,uint32_t& minR);
|
||||
virtual bool setMaxRates(const RsPgpId& pid,uint32_t maxUp,uint32_t maxDn);
|
||||
virtual bool getMaxRates(const RsPgpId& pid,uint32_t& maxUp,uint32_t& maxDn);
|
||||
virtual bool getMaxRates(const RsPeerId& pid,uint32_t& maxUp,uint32_t& maxDn);
|
||||
|
||||
/************************************************************************************************/
|
||||
/* Extra IMPL Functions (used by p3LinkMgr, p3NetMgr + Setup) */
|
||||
|
|
|
@ -276,9 +276,6 @@ class RsPeerDetails
|
|||
|
||||
/* linkType */
|
||||
uint32_t linkType;
|
||||
|
||||
uint32_t maxRateUp;
|
||||
uint32_t maxRateDn;
|
||||
};
|
||||
|
||||
// This class is used to get info about crytographic algorithms used with a
|
||||
|
|
|
@ -286,9 +286,6 @@ bool p3Peers::getPeerDetails(const RsPeerId& id, RsPeerDetails &d)
|
|||
return false;
|
||||
}
|
||||
|
||||
d.maxRateUp = ps.maxUpRate ;
|
||||
d.maxRateDn = ps.maxDnRate ;
|
||||
|
||||
/* get from gpg (first), to fill in the sign and trust details */
|
||||
/* don't return now, we've got fill in the ssl and connection info */
|
||||
getGPGDetails(ps.gpg_id, d);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue