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

Sending stop event on exit

Tags: None
(comma "," separated)
Nikolay
Registered Member
Posts
33
Karma
0

Sending stop event on exit

Thu Oct 13, 2005 5:06 pm
It seems that ktorrent doesn't send "stopped" event to the tracker on exit.
I take a look at the code that should doing this and I found that on exit
is deleting the list with TorrentControl objects. OK, from destructors of
these objects the stop function is invoked, but just after that is deleted and
the tracker object, which should be responsible for delivering of the event.
So as the consequence from deletion of the httptracker object
the QHttp object is deleted and that close the connection.
George
Moderator
Posts
5421
Karma
1

Re: Sending stop event on exit

Fri Oct 14, 2005 11:02 am
Nikolay wrote:It seems that ktorrent doesn't send "stopped" event to the tracker on exit.
I take a look at the code that should doing this and I found that on exit
is deleting the list with TorrentControl objects. OK, from destructors of
these objects the stop function is invoked, but just after that is deleted and
the tracker object, which should be responsible for delivering of the event.
So as the consequence from deletion of the httptracker object
the QHttp object is deleted and that close the connection.


This could be possible, the question is, can QHttp send the data before it's destroyed ? And does the tracker accept the data if the connection dies unexpectedly ?
Nikolay
Registered Member
Posts
33
Karma
0

Mon Oct 17, 2005 10:32 am
George wrote:And does the tracker accept the data if the connection dies unexpectedly ?

I think that we shouldn't worry about the tracker. We should ensure only that the data is transmited correctly before closing the connection.

George wrote:can QHttp send the data before it's destroyed

I'm not sure, I should check Qt code, but I think that no data will be send if you invoke QHttp::request() and immediately after that delete the object.

In the Qt documentation is written:
The function does not block and returns immediately. The request is scheduled, and its execution is performed asynchronously.


So to be sure that the "stopped" event is send to the tracker, on exit we should stop all currently running torrents, wait until requestFinished() signal is received, and then delete TorrentControl objects.

The main problem here is increased time for exiting from KT. And this time will depend upon number of the running torrents.


Bookmarks



Who is online

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