BUGFIX: Remember peer-level rate limits (requires libtorrent v0.16)

This commit is contained in:
Christophe Dumez 2011-04-17 15:35:40 +00:00
parent b41bcdc605
commit 719c30c70b
2 changed files with 18 additions and 2 deletions

View File

@ -5,6 +5,7 @@
- FEATURE: Added UPnP/NAT-PMP port forward for the Web UI port
- FEATURE: qBittorrent can update dynamic DNS services (DynDNS, no-ip)
- BUGFIX: Change systray icon on the fly (no restart needed)
- BUGFIX: Remember peer-level rate limits (requires libtorrent v0.16)
- COSMETIC: Added monochrome icon for light themes
* Sun Mar 20 2011 - Christophe Dumez <chris@qbittorrent.org> - v2.7.0

View File

@ -207,10 +207,18 @@ void PeerListWidget::banSelectedPeers(QStringList peer_ips) {
}
void PeerListWidget::limitUpRateSelectedPeers(QStringList peer_ips) {
if(peer_ips.empty()) return;
QTorrentHandle h = properties->getCurrentTorrent();
if(!h.is_valid()) return;
bool ok=false;
long limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Upload rate limiting"), -1, Preferences().getGlobalUploadLimit()*1024.);
int cur_limit = -1;
#if LIBTORRENT_VERSION_MINOR > 15
libtorrent::asio::ip::tcp::endpoint first_ep = peerEndpoints.value(peer_ips.first(),
libtorrent::asio::ip::tcp::endpoint());
if(first_ep != libtorrent::asio::ip::tcp::endpoint())
cur_limit = h.get_peer_upload_limit(first_ep);
#endif
long limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Upload rate limiting"), cur_limit, Preferences().getGlobalUploadLimit()*1024.);
if(!ok) return;
foreach(const QString &ip, peer_ips) {
libtorrent::asio::ip::tcp::endpoint ep = peerEndpoints.value(ip, libtorrent::asio::ip::tcp::endpoint());
@ -231,7 +239,14 @@ void PeerListWidget::limitDlRateSelectedPeers(QStringList peer_ips) {
QTorrentHandle h = properties->getCurrentTorrent();
if(!h.is_valid()) return;
bool ok=false;
long limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Download rate limiting"), -1, Preferences().getGlobalDownloadLimit()*1024.);
int cur_limit = -1;
#if LIBTORRENT_VERSION_MINOR > 15
libtorrent::asio::ip::tcp::endpoint first_ep = peerEndpoints.value(peer_ips.first(),
libtorrent::asio::ip::tcp::endpoint());
if(first_ep != libtorrent::asio::ip::tcp::endpoint())
cur_limit = h.get_peer_download_limit(first_ep);
#endif
long limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Download rate limiting"), cur_limit, Preferences().getGlobalDownloadLimit()*1024.);
if(!ok) return;
foreach(const QString &ip, peer_ips) {
libtorrent::asio::ip::tcp::endpoint ep = peerEndpoints.value(ip, libtorrent::asio::ip::tcp::endpoint());