Re: TrackerRequestSession - questions/ideas

Hi Peter,

I’ve tried to follow your comments and implemented interfaces of classes HttpRequestSession, TrackerRequestSession and TrackerRequestSessionStatus. I’ve pushed it to my calitko-dev branch and I’d like to ask you to take a look at it. There are no docs yet (it’s just a draft), but I think that it won’t be a problem for you to orientate in it. Implementation is also not done yet, only some testing scenarios are there (showing how it should work). I’d like to know whether this solution is suitable or some things should be changed. Ideas how to improve the interface are welcomed!

I’ve also some questions:

If I have a member function in a mockable object that has a parameter, this paramter (it’s class) must provide (as far as I’ve experienced) a operator== function, otherwise it won’t compile. Problem is that I’m using as parameters Http::RequestHeader and Http::ResponseHeader, but these classes don’t have the operator==. As a temporary solution I’ve made a bool operator== (const RequestHeader &header1, const RequestHeader &header2) function in the Http namespace which implements it. My question is - should I implement it in the Http::RequestHeader and Http::ResponseHeader classes or is there any other solution I should pick?

Second question is related to the TrackerRequestSession. How can (should) I test (implement) failures (reactions to failures)? For example if a request header cannot be sent (connection failed or something) - httpRequestSession->get() fails. Should I made these functions returning bool instead of void or there is some other way? I was thinking about adding some member functions like requestWasNotSent() (I think I’ve seen it somewhere), which gets called if a request transfer fails, but I don’t know where to “put” it… HttpRequestSession doesn’t know anything about TrackerRequestSessionStatus.

Thanks in advance!

Petr

Would you like to post a relpy?


This post is a reply to:
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...)

Follow-ups:
Re: TrackerRequestSession - questions/ideas
Hi Petr, I'm answering your questions generally first, then I'll write more comments (in a separate post) as I inspect the source code. As a temporary solution I’ve made a bool operator== (more...)