fixed a few small issues in new peer rates

This commit is contained in:
csoler 2016-06-07 22:06:32 -04:00
parent 20b6745f70
commit a1bbcd829d
2 changed files with 50 additions and 57 deletions

View file

@ -243,7 +243,7 @@ bool p3Peers::isFriend(const RsPeerId &ssl_id)
bool p3Peers::setPeerMaximumRates(const RsPeerId& pid,uint32_t maxUploadRate,uint32_t maxDownloadRate) bool p3Peers::setPeerMaximumRates(const RsPeerId& pid,uint32_t maxUploadRate,uint32_t maxDownloadRate)
{ {
mPeerMgr->setMaxRates(pid,maxUploadRate,maxDownloadRate) ; return mPeerMgr->setMaxRates(pid,maxUploadRate,maxDownloadRate) ;
} }
bool p3Peers::haveSecretKey(const RsPgpId& id) bool p3Peers::haveSecretKey(const RsPgpId& id)

View file

@ -117,18 +117,11 @@ ConfCertDialog::~ConfCertDialog()
if (it != instances_ssl.end()) if (it != instances_ssl.end())
instances_ssl.erase(it); instances_ssl.erase(it);
QMap<RsPgpId, ConfCertDialog*>::iterator it = instances_pgp.find(pgpId); QMap<RsPgpId, ConfCertDialog*>::iterator it2 = instances_pgp.find(pgpId);
if (it != instances_pgp.end()) if (it2 != instances_pgp.end())
instances_pgp.erase(it); instances_pgp.erase(it2);
} }
void ConfCertDialog::setTransferSpeeds()
{
uint32_t max_upload_speed = ui.maxUploadSpeed_SB->value() ;
uint32_t max_download_speed = ui.maxDownloadSpeed_SB->value();
rsPeers->setPeerMaxTransferRates(peerId,max_download_speed,max_upload_speed);
}
void ConfCertDialog::setServiceFlags() void ConfCertDialog::setServiceFlags()
{ {
@ -164,13 +157,8 @@ void ConfCertDialog::load()
ui._allow_push_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_ALLOW_PUSH) ; 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._require_WL_CB->setChecked( detail.service_perm_flags & RS_NODE_PERM_REQUIRE_WL) ;
uint32_t max_upload_speed = ui.maxUploadSpeed_SB->value() ; ui.maxUploadSpeed_SB->setValue(detail.maxRateUp) ;
uint32_t max_download_speed = ui.maxDownloadSpeed_SB->value(); ui.maxDownloadSpeed_SB->setValue(detail.maxRateDn) ;
rsPeers->getPeerMaxTransferRates(peerId,max_download_speed,max_upload_speed);
ui.maxUploadSpeed_SB->setValue(max_upload_speed) ;
ui.maxDownloadSpeed_SB->setValue(max_downupload_speed) ;
//ui.pgpfingerprint->setText(QString::fromUtf8(detail.name.c_str())); //ui.pgpfingerprint->setText(QString::fromUtf8(detail.name.c_str()));
ui.peerid->setText(QString::fromStdString(detail.id.toStdString())); ui.peerid->setText(QString::fromStdString(detail.id.toStdString()));
@ -406,6 +394,11 @@ void ConfCertDialog::applyDialog()
setServiceFlags() ; setServiceFlags() ;
uint32_t max_upload_speed = ui.maxUploadSpeed_SB->value() ;
uint32_t max_download_speed = ui.maxDownloadSpeed_SB->value();
rsPeers->setPeerMaximumRates(peerId,max_upload_speed,max_download_speed);
loadAll(); loadAll();
close(); close();
} }