mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed bug in setting MaxRate values
This commit is contained in:
parent
f5ad8b49be
commit
83a143476e
@ -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);
|
||||
|
@ -145,26 +145,8 @@ void PGPKeyDialog::load()
|
||||
ui.make_friend_button->setToolTip("") ;
|
||||
}
|
||||
|
||||
|
||||
//ui._direct_transfer_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_DIRECT_DL ) ;
|
||||
//ui._allow_push_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_ALLOW_PUSH) ;
|
||||
|
||||
ui.name->setText(QString::fromUtf8(detail.name.c_str()));
|
||||
//ui.peerid->setText(QString::fromStdString(detail.id.toStdString()));
|
||||
|
||||
//RetroShareLink link;
|
||||
//link.createPerson(detail.gpg_id);
|
||||
|
||||
//ui.rsid->setText(QString::fromStdString(detail.gpg_id.toStdString())) ;
|
||||
ui.pgpfingerprint->setText(misc::fingerPrintStyleSplit(QString::fromStdString(detail.fpr.toStdString())));
|
||||
//ui.rsid->setToolTip(link.title());
|
||||
|
||||
//ui.avatar->setId(pgpId.toStdString(), true);
|
||||
|
||||
// ui.rsid->show();
|
||||
// ui.peerid->hide();
|
||||
// ui.label_id->hide();
|
||||
// ui.label_rsid->show();
|
||||
|
||||
ui.pgpfingerprint->show();
|
||||
ui.pgpfingerprint_label->show();
|
||||
@ -173,23 +155,13 @@ void PGPKeyDialog::load()
|
||||
ui._allow_push_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_ALLOW_PUSH) ;
|
||||
ui._require_WL_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_REQUIRE_WL) ;
|
||||
|
||||
ui.maxUploadSpeed_SB->setValue(detail.maxRateUp) ;
|
||||
ui.maxDownloadSpeed_SB->setValue(detail.maxRateDn) ;
|
||||
uint32_t max_upload_speed = 0 ;
|
||||
uint32_t max_download_speed = 0 ;
|
||||
|
||||
// ui.loc->hide();
|
||||
// ui.label_loc->hide();
|
||||
// ui.statusline->hide();
|
||||
// ui.label_status->hide();
|
||||
// ui.lastcontact->hide();
|
||||
// ui.label_last_contact->hide();
|
||||
// ui.version->hide();
|
||||
// ui.label_version->hide();
|
||||
// ui.groupBox_4->hide();
|
||||
// ui.crypto_info->hide();
|
||||
// ui.crypto_label->hide();
|
||||
rsPeers->getPeerMaximumRates(pgpId,max_upload_speed,max_download_speed);
|
||||
|
||||
// ui.groupBox->hide();
|
||||
// ui.tabWidget->hide();
|
||||
ui.maxUploadSpeed_SB->setValue(max_upload_speed) ;
|
||||
ui.maxDownloadSpeed_SB->setValue(max_download_speed) ;
|
||||
|
||||
if (detail.gpg_id == rsPeers->getGPGOwnId())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user