TrackerRequestSession - questions/ideas

Hi Peter,

I’ve started the TrackerRequestSession implementation and I’ve got some questions/ideas:

1. Unifying URL storage.
I’ve noticed that now we’re using a QString for an announce URL storage in the Torrent[Parser], Http uses QUrl, TrackerRequestWriter uses QByteArray. Maybe it would be good to merge your Uri class (if it’s implemented everything for basic usage - I think it is) to the main branch so I can unify at least the Torrent[Parser] and the TrackerRequestWriter. Or should now just leave these classes and use QUrl in the TrackerRequestSession for now and we will unify it later?

2. Current TrackerRequestSession design/interface.
I’ve pushed my recent work to my calitko-dev branch. I’d be very grateful if you took a look at it and told me whether I’m on the right way or it would be better to do something differently. I’ve tried to inspire myself in the Protocols::BitTorrent::Transfers::Session class, though the TrackerRequestSession is a little bit different.

My idea is to implement the communication with a tracker by using ClientSession class in the Http package (is this class done/working/useful?). You wrote that it would be optimal to build it upon an HttpRequestSession, but I don’t know whether you ment to use a new class for that or the existing ClientSession class. This class needs a Connection-derived class instance in its constructor, so I was thinking about the TcpConnection class for that.

So the tracker communication scenario would be like this: First I’ll connect to the selected tracker with the help of a NameLookup class to get an address of that tracker (e.g. creat a Connection class instance). Then I’ll create a ClientSession instance using that connection. Then I’ll send a request (using a RequestHeader and ClientSession::get()) and wait for a response which will be parsed using a TrackerResponseParser class.

3. Mocks problems.
Is it possible to have static functions in the classes with CALITKO_TESTABLE marker? I haven’t studied it deeply (so it might be only my mistake) but when I had a static function in the TrackerRequestSession I got the following error during compilation:

Protocols/BitTorrent/Trackers/Testing/generated/TrackerRequestSessionDriver.h: In member function ‘std::auto_ptr > Protocols::BitTorrent::Trackers::Testing::TrackerRequestSessionDriver::createRequestUrl(const QUrl&, const Protocols::BitTorrent::Trackers::TrackerRequest&)’:
Protocols/BitTorrent/Trackers/Testing/generated/TrackerRequestSessionDriver.h:87: error: no matching function for call to ‘Utils::Testing::BoundFunction::BoundFunction(Protocols::BitTorrent::Trackers::TrackerRequestSession*, QUrl (*)(const QUrl&, const Protocols::BitTorrent::Trackers::TrackerRequest&), const QUrl&, const Protocols::BitTorrent::Trackers::TrackerRequest&)’
./Utils/Testing/BoundFunction.h:164: note: candidates are:
[...]

If I change that static function into a const member function, everything is fine.

Second problem is described in the TrackerRequestSession() dtor. I don’t want to have a public function disconnect() because connecting is done in the sendRequest() function, so maybe I just shouldn’t call the status object methods in the closeSessionWithTracker() and disconnectFromTracker() functions.

That would be everything what I have currently in mind. I’m looking forward for your comments!

Have a nice day,

Petr

Would you like to post a relpy?


This post starts a thread.
Follow-ups:
Re: TrackerRequestSession - questions/ideas
Hi Petr, Is it possible to have static functions in the classes with CALITKO_TESTABLE marker? I haven’t studied it deeply (so it might be only my mistake) but when I had (more...)
Re: TrackerRequestSession - questions/ideas
Hi Petr, 1. Unifying URL storage. I’ve noticed that now we’re using a QString for an announce URL storage in the Torrent[Parser], Http uses QUrl, TrackerRequestWriter uses QByteArray. Maybe it would be (more...)