[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kio/kio
From:       Andreas Hartmetz <ahartmetz () gmail ! com>
Date:       2010-01-18 21:37:53
Message-ID: 1263850673.941510.7026.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1076791 by ahartmetz:

Replace a useless duplicate assert with a useful/explanatory assert

 M  +8 -4      scheduler.cpp  


--- trunk/KDE/kdelibs/kio/kio/scheduler.cpp #1076790:1076791
@@ -415,15 +415,19 @@
 
     SimpleJobPrivate::get(job)->m_schedSerial = m_serialPicker.next();
 
+    const bool wasQueueEmpty = hq.isQueueEmpty();
     hq.queueJob(job);
-    // the queue's highest priority job may have changed, so update the ordered list of queues.
+    // note that HostQueue::queueJob() into an empty queue changes its lowestSerial() too...
+    // the queue's lowest serial job may have changed, so update the ordered list of queues.
     // however, we ignore all jobs that would cause more connections to a host than allowed.
     if (prevLowestSerial != hq.lowestSerial()) {
         if (hq.runningJobsCount() < m_maxConnectionsPerHost) {
-            // the next line may do nothing, that case is not an error
-            m_queuesBySerial.remove(prevLowestSerial);
+            // if the connection limit didn't keep the HQ unscheduled it must have been lack of jobs
+            if (m_queuesBySerial.remove(prevLowestSerial) == 0) {
+                Q_UNUSED(wasQueueEmpty);
+                Q_ASSERT(wasQueueEmpty);
+            }
             m_queuesBySerial.insert(hq.lowestSerial(), &hq);
-            Q_ASSERT(hq.runningJobsCount() < m_maxConnectionsPerHost);
         } else {
 #ifdef SCHEDULER_DEBUG
             // ### this assertion may fail if the limits were modified at runtime!
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic