include tracker message in tracker_alert

This commit is contained in:
Arvid Norberg 2015-02-21 22:45:45 +00:00
parent 89055c4c7a
commit f364fe7beb
3 changed files with 15 additions and 17 deletions

View File

@ -402,14 +402,14 @@ namespace libtorrent
torrent_status::state_t prev_state;
};
// This alert is generated on tracker time outs, premature disconnects, invalid response or
// a HTTP response other than "200 OK". From the alert you can get the handle to the torrent
// the tracker belongs to.
// This alert is generated on tracker time outs, premature disconnects,
// invalid response or a HTTP response other than "200 OK". From the alert
// you can get the handle to the torrent the tracker belongs to.
//
// The ``times_in_row`` member says how many times in a row this tracker has failed.
// ``status_code`` is the code returned from the HTTP server. 401 means the tracker needs
// authentication, 404 means not found etc. If the tracker timed out, the code will be set
// to 0.
// The ``times_in_row`` member says how many times in a row this tracker has
// failed. ``status_code`` is the code returned from the HTTP server. 401
// means the tracker needs authentication, 404 means not found etc. If the
// tracker timed out, the code will be set to 0.
struct TORRENT_EXPORT tracker_error_alert: tracker_alert
{
// internal
@ -439,9 +439,9 @@ namespace libtorrent
std::string msg;
};
// This alert is triggered if the tracker reply contains a warning field. Usually this
// means that the tracker announce was successful, but the tracker has a message to
// the client.
// This alert is triggered if the tracker reply contains a warning field.
// Usually this means that the tracker announce was successful, but the
// tracker has a message to the client.
struct TORRENT_EXPORT tracker_warning_alert: tracker_alert
{
// internal

View File

@ -155,12 +155,9 @@ namespace libtorrent {
std::string tracker_error_alert::message() const
{
char ret[400];
std::string error_message;
if (error) error_message = error.message();
else error_message = msg;
snprintf(ret, sizeof(ret), "%s (%d) %s (%d)"
snprintf(ret, sizeof(ret), "%s (%d) %s \"%s\" (%d)"
, tracker_alert::message().c_str(), status_code
, error_message.c_str(), times_in_row);
, error.message().c_str(), msg.c_str(), times_in_row);
return ret;
}

View File

@ -11506,7 +11506,7 @@ namespace libtorrent
}
void torrent::tracker_request_error(tracker_request const& r
, int response_code, error_code const& ec, const std::string& msg
, int response_code, error_code const& ec, std::string const& msg
, int retry_interval)
{
TORRENT_ASSERT(is_single_thread());
@ -11514,7 +11514,8 @@ namespace libtorrent
INVARIANT_CHECK;
#if defined TORRENT_LOGGING
debug_log("*** tracker error: (%d) %s %s", ec.value(), ec.message().c_str(), msg.c_str());
debug_log("*** tracker error: (%d) %s %s", ec.value()
, ec.message().c_str(), msg.c_str());
#endif
if (r.kind == tracker_request::announce_request)
{