OK, back to the topic at hand and this time it's KTorrent :ohyeah:
Whenever I'm downloading torrents and need to do other stuff like browsing/online radio then I used to set the download speed limit. Afterwards I would set the download speed back to zero (unlimited) and would notice that the speed would shoot up to 2-3 mbps for a few seconds even though I have a 512 kbps connection. This would happen in Transmission, KTorrent, utorrent etc.
Now why not make this download speed setting change automatic and continuous so that you get that speed boost frequently while the torrents are downloading?!
How to make it automatic? With open source and Free software you have da powa!
So I downloaded ktorrent source from ktorrent.org (or you can get it from KDE source code repository playground area) and after some code browsing to get familiar with it then made the following quick changes:
Added the following quick-n-dirty code and includes in gui.cpp and gui.h in ktorrent source:
....
#include <QThread>
....
class SpeedThread : public QThread
{
Q_OBJECT
protected:
void run();
};
....
#include <interfaces/functions.h>
....
void SpeedThread::run()
{
while (true)
{
Settings::setMaxDownloadRate(40);
kt::ApplySettings();
sleep(60);
Settings::setMaxDownloadRate(0);
kt::ApplySettings();
sleep(10);
}
}
....
SpeedThread * speedthread = new SpeedThread();
speedthread->start();
What that does is create and start a thread (it gets leaked though) that automatically changes the download speed settings, it keeps it at 40 kBps (320 kbps) for 1 minute (60 seconds) then makes it unlimited for 10 seconds. I've noticed if you keep the speed a little low for some time, say a minute, then change it to unlimited, it actually goes faster (1-2 mbps) for a few seconds before settling down to the normal speed.
So unless KTorrent (and Transmission and utorrent) are playing tricks on me, I would roughly calculate that this gives a 25% speed boost on average, meaning an extra 128 kbps on my 512 kbps connection!
Now I have yet to test whether this really works, will need to start a big download and manually measure the time taken and see if it was faster than expected ...