From 48ec57604fa0a0c449e938cb9bcfef0f5b2f627e Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 2 Aug 2008 19:46:02 +0000 Subject: [PATCH] - A queueing system ASSERT hit fix --- src/bittorrent.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 8f474876a..bb46039d5 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -204,6 +204,7 @@ void bittorrent::setMaxActiveTorrents(int val) { } void bittorrent::increaseDlTorrentPriority(QString hash) { + Q_ASSERT(queueingEnabled); int index = downloadQueue->indexOf(hash); Q_ASSERT(index != -1); if(index > 0) { @@ -215,6 +216,7 @@ void bittorrent::increaseDlTorrentPriority(QString hash) { } void bittorrent::increaseUpTorrentPriority(QString hash) { + Q_ASSERT(queueingEnabled); int index = uploadQueue->indexOf(hash); Q_ASSERT(index != -1); if(index > 0) { @@ -226,6 +228,7 @@ void bittorrent::increaseUpTorrentPriority(QString hash) { } void bittorrent::decreaseDlTorrentPriority(QString hash) { + Q_ASSERT(queueingEnabled); int index = downloadQueue->indexOf(hash); Q_ASSERT(index != -1); if(index >= 0 && index < (downloadQueue->size()-1)) { @@ -237,6 +240,7 @@ void bittorrent::decreaseDlTorrentPriority(QString hash) { } void bittorrent::decreaseUpTorrentPriority(QString hash) { + Q_ASSERT(queueingEnabled); int index = uploadQueue->indexOf(hash); Q_ASSERT(index != -1); if(index >= 0 && index < (uploadQueue->size()-1)) { @@ -817,8 +821,10 @@ bool bittorrent::resumeTorrent(QString hash) { torrentsToPauseAfterChecking.removeAt(index); success = true; } - updateDownloadQueue(); - updateUploadQueue(); + if(queueingEnabled) { + updateDownloadQueue(); + updateUploadQueue(); + } return success; }