mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 01:44:26 +00:00
BUGFIX: Limit the number of concurrent download threads to save memory
This commit is contained in:
parent
fed63b0b85
commit
cc4a542e9d
@ -4,6 +4,7 @@
|
||||
- FEATURE: The number of DHT nodes is displayed
|
||||
- FEATURE: RSS can now be disabled from program preferences
|
||||
- BUGFIX: Disable ETA calculation when ETA column is hidden
|
||||
- BUGFIX: Limit the number of concurrent download threads to save memory
|
||||
- COSMETIC: Transfer speed, ratio and DHT nodes are displayed in status bar
|
||||
- COSMETIC: RSS Tab is now hidden as a default
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include <QSettings>
|
||||
#include <stdio.h>
|
||||
|
||||
#define MAX_THREADS 3
|
||||
|
||||
// http://curl.rtin.bz/libcurl/c/libcurl-errors.html
|
||||
QString subDownloadThread::errorCodeToString(CURLcode status) {
|
||||
switch(status){
|
||||
@ -165,7 +167,7 @@ void downloadThread::run(){
|
||||
if(abort)
|
||||
return;
|
||||
mutex.lock();
|
||||
if(url_list.size() != 0){
|
||||
if(url_list.size() != 0 && subThreads.size() < MAX_THREADS){
|
||||
QString url = url_list.takeFirst();
|
||||
mutex.unlock();
|
||||
subDownloadThread *st = new subDownloadThread(0, url);
|
||||
@ -190,6 +192,9 @@ void downloadThread::propagateDownloadedFile(subDownloadThread* st, QString url,
|
||||
index = downloading_list.indexOf(url);
|
||||
Q_ASSERT(index != -1);
|
||||
downloading_list.removeAt(index);
|
||||
if(url_list.size() != 0) {
|
||||
condition.wakeOne();
|
||||
}
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
@ -203,5 +208,8 @@ void downloadThread::propagateDownloadFailure(subDownloadThread* st, QString url
|
||||
index = downloading_list.indexOf(url);
|
||||
Q_ASSERT(index != -1);
|
||||
downloading_list.removeAt(index);
|
||||
if(url_list.size() != 0) {
|
||||
condition.wakeOne();
|
||||
}
|
||||
mutex.unlock();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user