Skip to content

Commit

Permalink
- prevent downloadFromUrl flooding
Browse files Browse the repository at this point in the history
  • Loading branch information
Christophe Dumez committed Aug 27, 2007
1 parent 8f7de73 commit c7592a6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog
Expand Up @@ -50,6 +50,7 @@
- BUGFIX: Improved incremental download
- BUGFIX: Improved unicode support
- BUGFIX: Made torrent deletion from hard-drive safer
- BUGFIX: Prevent downloadFromUrl flooding
- COSMETIC: Redesigned torrent properties a little
- COSMETIC: Redesigned options a little
- COSMETIC: Display more logs messages concerning features
Expand Down
1 change: 1 addition & 0 deletions TODO
Expand Up @@ -80,3 +80,4 @@ beta5->beta6 changelog:
- BUGFIX: Fixed a bug when switching from finished to downloading list
- BUGFIX: Showing checking progress for paused torrents too
- BUGFIX: Fixed progress column sorting on startup
- BUGFIX: Prevent downloadFromUrl flooding
13 changes: 13 additions & 0 deletions src/downloadThread.h
Expand Up @@ -135,6 +135,7 @@ class downloadThread : public QThread {

private:
QStringList url_list;
QStringList downloading_list;
QMutex mutex;
QWaitCondition condition;
bool abort;
Expand All @@ -160,7 +161,9 @@ class downloadThread : public QThread {

void downloadUrl(QString url){
QMutexLocker locker(&mutex);
if(downloading_list.contains(url)) return;
url_list << url;
downloading_list << url;
if(!isRunning()){
start();
}else{
Expand Down Expand Up @@ -195,6 +198,11 @@ class downloadThread : public QThread {
subThreads.removeAt(index);
delete st;
emit downloadFinished(url, path);
mutex.lock();
index = downloading_list.indexOf(url);
Q_ASSERT(index != -1);
downloading_list.removeAt(index);
mutex.unlock();
}

void propagateDownloadFailure(subDownloadThread* st, QString url, QString reason){
Expand All @@ -203,6 +211,11 @@ class downloadThread : public QThread {
subThreads.removeAt(index);
delete st;
emit downloadFailure(url, reason);
mutex.lock();
index = downloading_list.indexOf(url);
Q_ASSERT(index != -1);
downloading_list.removeAt(index);
mutex.unlock();
}
};

Expand Down

0 comments on commit c7592a6

Please sign in to comment.