#include <SingleTrackerRequestSession.h> [code]
Inherits Protocols::BitTorrent::Trackers::TrackerRequestSession.
Inheritance diagram for Protocols::BitTorrent::Trackers::SingleTrackerRequestSession:
This class is used to send tracker requests using HTTP request session to the (single) tracker specified in the ctor. After the request is sent and the HTTP response recieved, this class will handle the HTTP response header, parse the raw response body and make the parsed tracker response available to get.
Definition at line 43 of file SingleTrackerRequestSession.h.
Public Member Functions | |
| SingleTrackerRequestSession (HttpRequestSession *, Uri, TrackerRequestSessionStatus *) | |
| Constructor. | |
| ~SingleTrackerRequestSession () | |
| Destructor. | |
| void | open () |
| Establishes the HttpRequestSession. | |
| void | sendRequest (const TrackerRequest &) |
| Sends a tracker request to the tracker. | |
| void | close () |
| Closes the session by closing the HttpRequestSession. | |
| void | abort () |
| Aborts the session by aborting the HttpRequestSession. | |
| void | httpRequestSessionEstablished () |
| HttpRequestSession was established. | |
| void | httpRequestSessionError (const QString &) |
| There was an error in the HttpRequestSession. | |
| void | httpRequestSessionResponseHeaderRecieved (const ResponseHeader &) |
| Handles HTTP response header. | |
| void | httpRequestSessionResponseBodyRecieved (const QByteArray &) |
| Handles HTTP response body. | |
| void | httpRequestSessionClosing () |
| HttpRequest started closing. | |
| void | httpRequestSessionClosed () |
| HttpRequestSession was closed. | |
Private Types | |
| enum | State { Established, RequestSent, ResponseHeaderRecieved, Closing, Closed } |
| States. More... | |
Private Member Functions | |
| CALITKO_TESTABLE | SingleTrackerRequestSession (const SingleTrackerRequestSession &) |
| SingleTrackerRequestSession & | operator= (const SingleTrackerRequestSession &) |
Static Private Member Functions | |
| static bool | httpRequestSucceeded (const ResponseHeader &) |
| static QString | createHttpRequestSessionErrorMessage (const QString &) |
| Creates and returns created error message from the original errorMessage. | |
| static QString | createHttpErrorMessage (const ResponseHeader &) |
| Creates and returns created HTTP error message from the responseHeader. | |
| static QString | createTrackerErrorMessage (const QString &) |
| Creates and returns created tracker error message from the failureReason. | |
Private Attributes | |
| HttpRequestSession * | httpRequestSession_ |
| const Uri | announceUrl_ |
| TrackerRequestSessionStatus * | status_ |
| State | state_ |
Static Private Attributes | |
| static const int | FirstSuccessfulHttpStatusCode = 200 |
| static const int | FirstHttpStatusCodePastSuccessfulCodes = 300 |
|
|
States.
Definition at line 69 of file SingleTrackerRequestSession.h. |
|
|
|
|
||||||||||||||||
|
Constructor.
Definition at line 42 of file SingleTrackerRequestSession.cpp. |
|
|
Destructor. Destroys a session. No status notifications are sent. Definition at line 57 of file SingleTrackerRequestSession.cpp. |
|
|
Aborts the session by aborting the HttpRequestSession. The HttpRequestSession will be aborted and then the session will be closed ( trackerRequestSessionClosed() notification will be sent). If the session has been already closed, nothing happens. Implements Protocols::BitTorrent::Trackers::TrackerRequestSession. Definition at line 119 of file SingleTrackerRequestSession.cpp. |
|
|
Closes the session by closing the HttpRequestSession. The HttpRequestSession will be closed (the trackerRequestSessionClosing() notification will be sent before that happens). It enters the Closing state
Implements Protocols::BitTorrent::Trackers::TrackerRequestSession. Definition at line 104 of file SingleTrackerRequestSession.cpp. |
|
|
Creates and returns created HTTP error message from the responseHeader.
Definition at line 271 of file SingleTrackerRequestSession.cpp. |
|
|
Creates and returns created error message from the original errorMessage.
Definition at line 260 of file SingleTrackerRequestSession.cpp. |
|
|
Creates and returns created tracker error message from the failureReason.
Definition at line 283 of file SingleTrackerRequestSession.cpp. |
|
|
HttpRequestSession was closed. Session gets closed - it enters the Closed state (nothing could be sent or handled after then) and trackerRequestSessionClosed() notification will be sent). Definition at line 238 of file SingleTrackerRequestSession.cpp. |
|
|
HttpRequest started closing. Session enters the Closing state (nothing could be sent or handled after then). No status notifications are sent. Definition at line 225 of file SingleTrackerRequestSession.cpp. |
|
|
There was an error in the HttpRequestSession.
Definition at line 149 of file SingleTrackerRequestSession.cpp. |
|
|
HttpRequestSession was established. Session gets established (trackerRequestSessionEstablished() notification will be sent). Definition at line 133 of file SingleTrackerRequestSession.cpp. |
|
|
Handles HTTP response body.
Definition at line 198 of file SingleTrackerRequestSession.cpp. |
|
|
Handles HTTP response header.
Definition at line 169 of file SingleTrackerRequestSession.cpp. |
|
|
Definition at line 248 of file SingleTrackerRequestSession.cpp. |
|
|
Establishes the HttpRequestSession. HttpRequestSession must be established as first in order to send requests to the tracker. No status notifications are sent.
Implements Protocols::BitTorrent::Trackers::TrackerRequestSession. Definition at line 68 of file SingleTrackerRequestSession.cpp. |
|
|
|
|
|
Sends a tracker request to the tracker.
Implements Protocols::BitTorrent::Trackers::TrackerRequestSession. Definition at line 85 of file SingleTrackerRequestSession.cpp. |
|
|
Definition at line 89 of file SingleTrackerRequestSession.h. |
|
|
Definition at line 85 of file SingleTrackerRequestSession.h. |
|
|
Definition at line 84 of file SingleTrackerRequestSession.h. |
|
|
Definition at line 88 of file SingleTrackerRequestSession.h. |
|
|
Definition at line 91 of file SingleTrackerRequestSession.h. |
|
|
Definition at line 90 of file SingleTrackerRequestSession.h. |