mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-28 00:07:09 -05:00
fixed setting/getting maxrates using pgp id
This commit is contained in:
parent
a07805be1d
commit
a4931edee0
@ -2076,17 +2076,11 @@ bool p3PeerMgrIMPL::saveList(bool &cleanup, std::list<RsItem *>& saveData)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3PeerMgrIMPL::getMaxRates(const RsPeerId& pid,uint32_t& maxUp,uint32_t& maxDn)
|
bool p3PeerMgrIMPL::getMaxRates(const RsPgpId& pid,uint32_t& maxUp,uint32_t& maxDn)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
/* check if it is a friend */
|
std::map<RsPgpId,PeerBandwidthLimits>::const_iterator it2 = mPeerBandwidthLimits.find(pid) ;
|
||||||
std::map<RsPeerId, peerState>::iterator it = mFriendList.find(pid) ;
|
|
||||||
|
|
||||||
if(mFriendList.end() == it)
|
|
||||||
return false ;
|
|
||||||
|
|
||||||
std::map<RsPgpId,PeerBandwidthLimits>::const_iterator it2 = mPeerBandwidthLimits.find(it->second.gpg_id) ;
|
|
||||||
|
|
||||||
if(it2 != mPeerBandwidthLimits.end())
|
if(it2 != mPeerBandwidthLimits.end())
|
||||||
{
|
{
|
||||||
@ -2101,23 +2095,22 @@ bool p3PeerMgrIMPL::getMaxRates(const RsPeerId& pid,uint32_t& maxUp,uint32_t& ma
|
|||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool p3PeerMgrIMPL::setMaxRates(const RsPeerId& pid,uint32_t maxUp,uint32_t maxDn)
|
bool p3PeerMgrIMPL::setMaxRates(const RsPgpId& pid,uint32_t maxUp,uint32_t maxDn)
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
RsStackMutex stack(mPeerMtx); /****** STACK LOCK MUTEX *******/
|
||||||
|
|
||||||
/* check if it is a friend */
|
std::map<RsPgpId, PeerBandwidthLimits>::iterator it = mPeerBandwidthLimits.find(pid) ;
|
||||||
std::map<RsPeerId, peerState>::iterator it = mFriendList.find(pid) ;
|
|
||||||
|
|
||||||
if(mFriendList.end() == it)
|
if(mPeerBandwidthLimits.end() == it)
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
if(maxUp == it->second.maxUpRate && maxDn == it->second.maxDnRate)
|
if(maxUp == it->second.max_up_rate_kbs && maxDn == it->second.max_dl_rate_kbs)
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
std::cerr << "Updating max rates for peer " << pid << " to " << maxUp << " kB/s (up), " << maxDn << " kB/s (dn)" << std::endl;
|
std::cerr << "Updating max rates for peer " << pid << " to " << maxUp << " kB/s (up), " << maxDn << " kB/s (dn)" << std::endl;
|
||||||
|
|
||||||
it->second.maxUpRate = maxUp ;
|
it->second.max_up_rate_kbs = maxUp ;
|
||||||
it->second.maxDnRate = maxDn ;
|
it->second.max_dl_rate_kbs = maxDn ;
|
||||||
|
|
||||||
IndicateConfigChanged();
|
IndicateConfigChanged();
|
||||||
|
|
||||||
|
@ -209,8 +209,8 @@ virtual uint32_t getHiddenType(const RsPeerId &ssl_id) = 0;
|
|||||||
|
|
||||||
|
|
||||||
virtual int getFriendCount(bool ssl, bool online) = 0;
|
virtual int getFriendCount(bool ssl, bool online) = 0;
|
||||||
virtual bool setMaxRates(const RsPeerId& pid,uint32_t maxR,uint32_t minR)=0;
|
virtual bool setMaxRates(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 getMaxRates(const RsPgpId& pid,uint32_t& maxR,uint32_t& minR)=0;
|
||||||
|
|
||||||
/************* DEPRECIATED FUNCTIONS (TO REMOVE) ********/
|
/************* DEPRECIATED FUNCTIONS (TO REMOVE) ********/
|
||||||
|
|
||||||
@ -325,8 +325,8 @@ virtual int getFriendCount(bool ssl, bool online);
|
|||||||
// Single Use Function... shouldn't be here. used by p3serverconfig.cc
|
// Single Use Function... shouldn't be here. used by p3serverconfig.cc
|
||||||
virtual bool haveOnceConnected();
|
virtual bool haveOnceConnected();
|
||||||
|
|
||||||
virtual bool setMaxRates(const RsPeerId& pid,uint32_t maxR,uint32_t minR);
|
virtual bool setMaxRates(const RsPgpId& pid,uint32_t maxR,uint32_t minR);
|
||||||
virtual bool getMaxRates(const RsPeerId& pid,uint32_t& maxR,uint32_t& minR);
|
virtual bool getMaxRates(const RsPgpId& pid,uint32_t& maxR,uint32_t& minR);
|
||||||
|
|
||||||
/************************************************************************************************/
|
/************************************************************************************************/
|
||||||
/* Extra IMPL Functions (used by p3LinkMgr, p3NetMgr + Setup) */
|
/* Extra IMPL Functions (used by p3LinkMgr, p3NetMgr + Setup) */
|
||||||
|
@ -432,8 +432,8 @@ public:
|
|||||||
virtual ServicePermissionFlags servicePermissionFlags(const RsPeerId& ssl_id) = 0;
|
virtual ServicePermissionFlags servicePermissionFlags(const RsPeerId& ssl_id) = 0;
|
||||||
virtual void setServicePermissionFlags(const RsPgpId& gpg_id,const ServicePermissionFlags& flags) = 0;
|
virtual void setServicePermissionFlags(const RsPgpId& gpg_id,const ServicePermissionFlags& flags) = 0;
|
||||||
|
|
||||||
virtual bool setPeerMaximumRates(const RsPeerId& pid,uint32_t maxUploadRate,uint32_t maxDownloadRate) =0;
|
virtual bool setPeerMaximumRates(const RsPgpId& pid,uint32_t maxUploadRate,uint32_t maxDownloadRate) =0;
|
||||||
virtual bool getPeerMaximumRates(const RsPeerId& pid,uint32_t& maxUploadRate,uint32_t& maxDownloadRate) =0;
|
virtual bool getPeerMaximumRates(const RsPgpId& pid,uint32_t& maxUploadRate,uint32_t& maxDownloadRate) =0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -241,12 +241,12 @@ bool p3Peers::isFriend(const RsPeerId &ssl_id)
|
|||||||
return mPeerMgr->isFriend(ssl_id);
|
return mPeerMgr->isFriend(ssl_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::getPeerMaximumRates(const RsPeerId& pid,uint32_t& maxUploadRate,uint32_t& maxDownloadRate)
|
bool p3Peers::getPeerMaximumRates(const RsPgpId& pid,uint32_t& maxUploadRate,uint32_t& maxDownloadRate)
|
||||||
{
|
{
|
||||||
return mPeerMgr->getMaxRates(pid,maxUploadRate,maxDownloadRate) ;
|
return mPeerMgr->getMaxRates(pid,maxUploadRate,maxDownloadRate) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool p3Peers::setPeerMaximumRates(const RsPeerId& pid,uint32_t maxUploadRate,uint32_t maxDownloadRate)
|
bool p3Peers::setPeerMaximumRates(const RsPgpId& pid,uint32_t maxUploadRate,uint32_t maxDownloadRate)
|
||||||
{
|
{
|
||||||
return mPeerMgr->setMaxRates(pid,maxUploadRate,maxDownloadRate) ;
|
return mPeerMgr->setMaxRates(pid,maxUploadRate,maxDownloadRate) ;
|
||||||
}
|
}
|
||||||
|
@ -139,8 +139,8 @@ public:
|
|||||||
virtual ServicePermissionFlags servicePermissionFlags(const RsPeerId & ssl_id);
|
virtual ServicePermissionFlags servicePermissionFlags(const RsPeerId & ssl_id);
|
||||||
virtual void setServicePermissionFlags(const RsPgpId& gpg_id,const ServicePermissionFlags& flags);
|
virtual void setServicePermissionFlags(const RsPgpId& gpg_id,const ServicePermissionFlags& flags);
|
||||||
|
|
||||||
virtual bool setPeerMaximumRates(const RsPeerId& pid,uint32_t maxUploadRate,uint32_t maxDownloadRate);
|
virtual bool setPeerMaximumRates(const RsPgpId& pid,uint32_t maxUploadRate,uint32_t maxDownloadRate);
|
||||||
virtual bool getPeerMaximumRates(const RsPeerId& pid,uint32_t& maxUploadRate,uint32_t& maxDownloadRate);
|
virtual bool getPeerMaximumRates(const RsPgpId& pid,uint32_t& maxUploadRate,uint32_t& maxDownloadRate);
|
||||||
private:
|
private:
|
||||||
|
|
||||||
p3LinkMgr *mLinkMgr;
|
p3LinkMgr *mLinkMgr;
|
||||||
|
@ -397,7 +397,7 @@ void ConfCertDialog::applyDialog()
|
|||||||
uint32_t max_upload_speed = ui.maxUploadSpeed_SB->value() ;
|
uint32_t max_upload_speed = ui.maxUploadSpeed_SB->value() ;
|
||||||
uint32_t max_download_speed = ui.maxDownloadSpeed_SB->value();
|
uint32_t max_download_speed = ui.maxDownloadSpeed_SB->value();
|
||||||
|
|
||||||
rsPeers->setPeerMaximumRates(peerId,max_upload_speed,max_download_speed);
|
rsPeers->setPeerMaximumRates(pgpId,max_upload_speed,max_download_speed);
|
||||||
|
|
||||||
loadAll();
|
loadAll();
|
||||||
close();
|
close();
|
||||||
|
@ -18,24 +18,15 @@
|
|||||||
<normaloff>:/images/logo/logo_16.png</normaloff>:/images/logo/logo_16.png</iconset>
|
<normaloff>:/images/logo/logo_16.png</normaloff>:/images/logo/logo_16.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
<layout class="QGridLayout" name="gridLayout_5">
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="horizontalSpacing">
|
<property name="horizontalSpacing">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="HeaderFrame" name="headerFrame">
|
<widget class="HeaderFrame" name="headerFrame">
|
||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
@ -454,6 +445,13 @@
|
|||||||
<string>Options</string>
|
<string>Options</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>These options apply to all locations of the same node:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="_direct_transfer_CB">
|
<widget class="QCheckBox" name="_direct_transfer_CB">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user