This forum has been archived. All content is frozen. Please use KDE Discuss instead.

start/stop all problem with svn 527372

Tags: None
(comma "," separated)
cade
Registered Member
Posts
70
Karma
0
-- stopped all files
-- started just one for download
-- changing settings for upload rate to something

at this point all download files are started

-- stopped all again
-- started one (the same as above)

when the one file downloading is finished, again all
files are started (seeding and downloads).

at some point I didn't believe I can stop anything at all :))

is this known behaviour?

thanks.
stoeptegel
Registered Member
Posts
1075
Karma
0

Sat Apr 08, 2006 11:59 pm
Nope, i've not read this in the forum or bugs.kde.org yet.

I was thinking of the added queue manager for the seeding part some days back, but then you said that you stopped all torrents first, which *should* make the torrents automaticly controlled by user and disabled for queuemanager.

I haven't seen this bug popup yet in my client here.
Have you informed yourself with the change that the start/stop all button only does the active download or upload tab?
cade
Registered Member
Posts
70
Karma
0

Sun Apr 09, 2006 2:41 am
yes it seems like start/stop *all* buttons actually does not mean *all*...

however, if you activate upload tab (seed) then press stopall button, go to the
settings and change upload rate, you will get all torrents seeding without further action taken.

also if you have only one active download (all other down/seeds stopped),
upon completion all the rest are activated again (bot downloads and seeds).

adding new torrent also activates everything...

the point is that there are too many cases when torrents are activated without
explicit 'start action' but after explicit 'stop action'. a bit weird...
stoeptegel
Registered Member
Posts
1075
Karma
0

Sun Apr 09, 2006 5:09 am
All those cases are not happening here with latest SVN. I guess there must be something wrong with your installation.(?)
imported4-Ivan
Registered Member
Posts
819
Karma
0

Sun Apr 09, 2006 10:27 am
Can't make it happen here but I have one guess: Do you have max concurrent downloads/uploads limit set?
cade
Registered Member
Posts
70
Karma
0

Sun Apr 09, 2006 10:48 am
max connections per download 64

and I do not believe there is something wrong with my "installation"
(whatever it means) :))
imported4-Ivan
Registered Member
Posts
819
Karma
0

Sun Apr 09, 2006 11:09 am
Wrong guess. Except maybe you don't have limits for seeding (you did not mention that)?

I'll have to look at the code again since I cannot reproduce it. Do you by any chance have some debugging skills? I can give you some directions on how to use KDevelop for debugging.
cade
Registered Member
Posts
70
Karma
0

Sun Apr 09, 2006 4:32 pm
no limits, i.e. defaults. I changed only connections per download.

I'm fluent in programming and debugging. just tell me what source files and/or
functions to look for? would save me time. thanks.
cade
Registered Member
Posts
70
Karma
0

Sun Apr 09, 2006 5:46 pm
I'm trying to dig it myself, here is the backtrace after preferences:

Breakpoint 4, bt::QueueManager::start (this=0x8259350, tc=0x8259378, user=182) at queuemanager.cpp:79
79 {
(gdb) bt
#0 bt::QueueManager::start (this=0x8259350, tc=0x8259378, user=182) at queuemanager.cpp:79
#1 0xb7ef1fb2 in bt::QueueManager::orderQueue (this=0x8259350) at queuemanager.cpp:413
#2 0x08060584 in KTorrent::applySettings (this=0x8128b00, change_port=true) at ktorrent.cpp:304
#3 0x08067fb3 in KTorrentPreferences::slotApply (this=0x815f988) at pref.cpp:94
#4 0x08065e73 in KTorrentPreferences::slotOk (this=0x815f988) at pref.cpp:74
#5 0xb79412be in KDialogBase::qt_invoke () from /opt/kde/lib/libkdeui.so.4
#6 0x08067697 in KTorrentPreferences::qt_invoke (this=0x815f988, _id=73, _o=0xbf97e0f0) at pref.moc:176
#7 0xb6fc54e4 in QObject::activate_signal () from /usr/lib/qt/lib/libqt-mt.so.3
...

bt::QueueManager::orderQueue() is called after prefs dialog and it starts all downloads if they are not started:

bt::QueueManager::orderQueue (this=0x7f6) at queuemanager.cpp:311
311 if(!downloads.count())
(gdb) n
310 {
(gdb)
311 if(!downloads.count())
(gdb)
310 {
(gdb)
311 if(!downloads.count())
(gdb)
314 downloads.sort();
(gdb)
316 QPtrList<TorrentInterface>::const_iterator it = downloads.begin();
(gdb)
317 QPtrList<TorrentInterface>::const_iterator its = downloads.end();
(gdb)
320 if(max_downloads != 0 || max_seeds != 0)
(gdb)
317 QPtrList<TorrentInterface>::const_iterator its = downloads.end();
(gdb)
320 if(max_downloads != 0 || max_seeds != 0)
(gdb)
407 for(it=downloads.begin(); it!=downloads.end(); ++it)
(gdb)
409 TorrentInterface* tc = *it;
(gdb)
410 const TorrentStats & s = tc->getStats();
(gdb)
409 TorrentInterface* tc = *it;
(gdb)
410 const TorrentStats & s = tc->getStats();
(gdb)
412 if(!s.running)
(gdb)
413 start(tc);
(gdb)
imported4-Ivan
Registered Member
Posts
819
Karma
0

Sun Apr 09, 2006 5:52 pm
Check out libktorrent/queuemanager.cpp and look for the function orderQueue().
This function is called everytime preferences are changed (concurrent downloads/uploads limits), torrent is added, removed etc..

From your post I can see that on every supposed action when orderQueue() is called something goes wrong.

max_downloads, max_seeds are variables that hold your preferences so check them. downloads is a QPtrList which holds all torrents. They are iterated with the first 'for' loop in that function so you may want to check out something else in there:
tc->getStats() returns torrent stats. Look for
- autostart (whether torrent should be started at KT startup)
- user_controlled (whether torrent is controlled by user - in that case orderQueue() should have NO EFFECT AT ALL on that torrent)

That should be all for now I think. My guess is that user controlled torrents are somehow started by QM which should not happen. It's really weird that it doesn't happen here... Stupid question but are you sure you have the latest SVN?
cade
Registered Member
Posts
70
Karma
0

Sun Apr 09, 2006 6:29 pm
It is not stupid: At revision 527960. as of today.

I think it is clear:

in void QueueManager::orderQueue()

the "big if" (line 320) is if( max_downloads != 0 || max_seeds != 0 ), both are 0 here so 'else' is executed and it is simple: start everyone unless started:

Code: Select all
      else
      {
         //no limits at all
         for(it=downloads.begin(); it!=downloads.end(); ++it)
         {
            TorrentInterface* tc = *it;
            const TorrentStats & s = tc->getStats();
                       
            if(!s.running)
               start(tc);
         }
      }


my guess is that here should be something like:

Code: Select all
            if( !s.running && !s.user_controlled )
               start(tc);


works fine, hope none side effects :)
imported4-Ivan
Registered Member
Posts
819
Karma
0

Sun Apr 09, 2006 6:40 pm
:)
I completely forgot about that part. You're right. That is exactly how it's supposed to work.

This solves your problem, right?

I'll commit the changes asap.
cade
Registered Member
Posts
70
Karma
0

Sun Apr 09, 2006 7:23 pm
great, thanks :)

now the stop button for single torrent does not work :)

Code: Select all
void KTorrent::stopDownload()
{
        TorrentInterface* tc = getCurrentView()->getCurrentTC();
        if (tc && tc->getStats().running)
        {
                //tc->stop(true);
                m_core->stop(tc, true);
                if(getCurrentPanel() == DOWNLOAD_VIEW)
                        currentDownloadChanged(tc);
                if(getCurrentPanel() == SEED_VIEW)
                        currentSeedChanged(tc);
        }
}


surplus of comments, isn't it :)
imported4-Ivan
Registered Member
Posts
819
Karma
0

Sun Apr 09, 2006 9:52 pm
I'm not sure I understand. What happens actually? Code seems fine.

Code change you helped with is committed.
cade
Registered Member
Posts
70
Karma
0

Sun Apr 09, 2006 10:24 pm
first I assumed the comment on tc->stop() is wrong. however the problem is different.
when torrent is requested to stop all goes as planned until orderQueue() is called.
then this torrent is started again. so there is no way to stop single torrent.

I didn't dig how stopAll differs than stopDownload but there is something.

I start to think that orderQueue() shouldn't start any torrent automatically, or
at least just do it once when ktorrent starts. I could be wrong but I don't see case
where torrent is stopped and is not user controlled and has to be started again.
perhaps the file descriptors problem is actually such case but it is not solution (i.e. descriptors problem should be solved).

Excuse me if I made wrong conclusions I spent only about half an hour looking
inside ktorrent... trying to help :)


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]