|
|
@ -156,7 +156,6 @@ void bittorrent::setDownloadLimit(QString hash, long val) { |
|
|
|
QTorrentHandle h = getTorrentHandle(hash); |
|
|
|
QTorrentHandle h = getTorrentHandle(hash); |
|
|
|
if(h.is_valid()) { |
|
|
|
if(h.is_valid()) { |
|
|
|
h.set_download_limit(val); |
|
|
|
h.set_download_limit(val); |
|
|
|
TorrentPersistentData::saveSpeedLimits(h); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -169,7 +168,6 @@ void bittorrent::setUploadLimit(QString hash, long val) { |
|
|
|
QTorrentHandle h = getTorrentHandle(hash); |
|
|
|
QTorrentHandle h = getTorrentHandle(hash); |
|
|
|
if(h.is_valid()) { |
|
|
|
if(h.is_valid()) { |
|
|
|
h.set_upload_limit(val); |
|
|
|
h.set_upload_limit(val); |
|
|
|
TorrentPersistentData::saveSpeedLimits(h); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -701,19 +699,12 @@ QTorrentHandle bittorrent::addMagnetUri(QString magnet_uri, bool resumed) { |
|
|
|
h.set_max_connections(Preferences::getMaxConnecsPerTorrent()); |
|
|
|
h.set_max_connections(Preferences::getMaxConnecsPerTorrent()); |
|
|
|
// Uploads limit per torrent
|
|
|
|
// Uploads limit per torrent
|
|
|
|
h.set_max_uploads(Preferences::getMaxUploadsPerTorrent()); |
|
|
|
h.set_max_uploads(Preferences::getMaxUploadsPerTorrent()); |
|
|
|
// Speed limits
|
|
|
|
|
|
|
|
if(TorrentPersistentData::isKnownTorrent(h.hash())) { |
|
|
|
|
|
|
|
h.set_download_limit(TorrentPersistentData::getDownloadLimit(h.hash())); |
|
|
|
|
|
|
|
h.set_upload_limit(TorrentPersistentData::getUploadLimit(h.hash())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Resolve countries
|
|
|
|
// Resolve countries
|
|
|
|
h.resolve_countries(resolve_countries); |
|
|
|
h.resolve_countries(resolve_countries); |
|
|
|
// Load filtered files
|
|
|
|
// Load filtered files
|
|
|
|
if(resumed) { |
|
|
|
if(resumed) { |
|
|
|
// Load custom url seeds
|
|
|
|
// Load custom url seeds
|
|
|
|
loadWebSeeds(hash); |
|
|
|
loadWebSeeds(hash); |
|
|
|
// Load speed limit from hard drive
|
|
|
|
|
|
|
|
loadTorrentSpeedLimits(hash); |
|
|
|
|
|
|
|
// Load trackers
|
|
|
|
// Load trackers
|
|
|
|
loadTrackerFile(hash); |
|
|
|
loadTrackerFile(hash); |
|
|
|
// XXX: only when resuming because torrentAddition dialog is not supported yet
|
|
|
|
// XXX: only when resuming because torrentAddition dialog is not supported yet
|
|
|
@ -880,11 +871,6 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr |
|
|
|
h.set_max_connections(Preferences::getMaxConnecsPerTorrent()); |
|
|
|
h.set_max_connections(Preferences::getMaxConnecsPerTorrent()); |
|
|
|
// Uploads limit per torrent
|
|
|
|
// Uploads limit per torrent
|
|
|
|
h.set_max_uploads(Preferences::getMaxUploadsPerTorrent()); |
|
|
|
h.set_max_uploads(Preferences::getMaxUploadsPerTorrent()); |
|
|
|
// Speed limits
|
|
|
|
|
|
|
|
if(TorrentPersistentData::isKnownTorrent(h.hash())) { |
|
|
|
|
|
|
|
h.set_download_limit(TorrentPersistentData::getDownloadLimit(h.hash())); |
|
|
|
|
|
|
|
h.set_upload_limit(TorrentPersistentData::getUploadLimit(h.hash())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Resolve countries
|
|
|
|
// Resolve countries
|
|
|
|
qDebug("AddTorrent: Resolve_countries: %d", (int)resolve_countries); |
|
|
|
qDebug("AddTorrent: Resolve_countries: %d", (int)resolve_countries); |
|
|
|
h.resolve_countries(resolve_countries); |
|
|
|
h.resolve_countries(resolve_countries); |
|
|
@ -893,8 +879,6 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr |
|
|
|
if(resumed) { |
|
|
|
if(resumed) { |
|
|
|
// Load custom url seeds
|
|
|
|
// Load custom url seeds
|
|
|
|
loadWebSeeds(hash); |
|
|
|
loadWebSeeds(hash); |
|
|
|
// Load speed limit from hard drive
|
|
|
|
|
|
|
|
loadTorrentSpeedLimits(hash); |
|
|
|
|
|
|
|
// Load trackers
|
|
|
|
// Load trackers
|
|
|
|
loadTrackerFile(hash); |
|
|
|
loadTrackerFile(hash); |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -977,7 +961,6 @@ void bittorrent::setMaxConnectionsPerTorrent(int max) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
h.set_max_connections(max); |
|
|
|
h.set_max_connections(max); |
|
|
|
TorrentPersistentData::saveSpeedLimits(h); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -992,7 +975,6 @@ void bittorrent::setMaxUploadsPerTorrent(int max) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
h.set_max_uploads(max); |
|
|
|
h.set_max_uploads(max); |
|
|
|
TorrentPersistentData::saveSpeedLimits(h); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1102,13 +1084,6 @@ bool bittorrent::enableDHT(bool b) { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void bittorrent::loadTorrentSpeedLimits(QString hash) { |
|
|
|
|
|
|
|
QTorrentHandle h = getTorrentHandle(hash); |
|
|
|
|
|
|
|
qDebug("Loading speedLimits file for %s", hash.toLocal8Bit().data()); |
|
|
|
|
|
|
|
h.set_download_limit(TorrentPersistentData::getDownloadLimit(hash)); |
|
|
|
|
|
|
|
h.set_upload_limit(TorrentPersistentData::getUploadLimit(hash)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Read pieces priorities from hard disk
|
|
|
|
// Read pieces priorities from hard disk
|
|
|
|
// and ask QTorrentHandle to consider them
|
|
|
|
// and ask QTorrentHandle to consider them
|
|
|
|
void bittorrent::loadFilesPriorities(QTorrentHandle &h) { |
|
|
|
void bittorrent::loadFilesPriorities(QTorrentHandle &h) { |
|
|
|