Bug 144493 - Incorrect total speed is displayed on multithread transfers
Summary: Incorrect total speed is displayed on multithread transfers
Status: RESOLVED FIXED
Alias: None
Product: kftpgrabber
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Jernej Kos
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-21 16:40 UTC by David Gnedt
Modified: 2007-04-21 17:09 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch to fix this bug (1.03 KB, patch)
2007-04-21 16:40 UTC, David Gnedt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Gnedt 2007-04-21 16:40:17 UTC
Version:           0.8.1 rev 656433 (using KDE KDE 3.5.6)
Installed from:    Ubuntu Packages
Compiler:          gcc 4.1.2 (Ubuntu 4.1.2-0ubuntu4) 
OS:                Linux

If more than one thread is used the total speed displayed in the queue and the status bar is incorrect. It displays randomly the speed of one of the threads instead of displaying the speed of all threads. I looked at the source code and noticed that every object in the queue sets the speed of it's parent object. I have attached a patch to fix this bug.
Comment 1 David Gnedt 2007-04-21 16:40:57 UTC
Created attachment 20347 [details]
patch to fix this bug
Comment 2 Jernej Kos 2007-04-21 17:09:36 UTC
SVN commit 656501 by kostko:

Commited a patch by David Gnedt that fixes incorrect total speed display for multithreaded transfers.

BUG: 144493

 M  +11 -2     queueobject.cpp  
 M  +1 -1      queueobject.h  


--- trunk/extragear/network/kftpgrabber/src/queueobject.cpp #656500:656501
@@ -121,13 +121,22 @@
 
 void QueueObject::setSpeed(filesize_t speed)
 {
-  if (m_speed == speed)
+  if (speed != 0 && m_speed == speed)
     return;
   
   m_speed = speed;
   
+  QPtrListIterator<QueueObject> it(m_children);
+  QueueObject *i;
+  
+  while ((i = it.current()) != 0) {
+    ++it;
+    
+    m_speed += i->getSpeed();
+  }
+  
   if (hasParentObject())
-    parentObject()->setSpeed(speed);
+    parentObject()->setSpeed();
     
   statisticsUpdated();
 }
--- trunk/extragear/network/kftpgrabber/src/queueobject.h #656500:656501
@@ -194,7 +194,7 @@
      *
      * @param speed Speed to set
      */
-    void setSpeed(filesize_t speed);
+    void setSpeed(filesize_t speed = 0);
     
     /**
      * Returns the KFTPQueue::Transfer::Type of this transfer. This can either be