reports event in tracker_announce_alert

This commit is contained in:
Arvid Norberg
2008-07-11 12:00:29 +00:00
parent 792726be8d
commit 486fb1082d
4 changed files with 37 additions and 4 deletions

View File

@@ -3798,6 +3798,20 @@ struct file_error_alert: torrent_alert
<p>This alert is generated each time a tracker announce is sent (or attempted to be sent). <p>This alert is generated each time a tracker announce is sent (or attempted to be sent).
There are no extra data members in this alert. The url can be found in the base class There are no extra data members in this alert. The url can be found in the base class
however.</p> however.</p>
<pre class="literal-block">
struct tracker_announce_alert: tracker_alert
{
// ...
int event;
};
</pre>
<p>Event specifies what event was sent to the tracker. It is defined as:</p>
<ol class="arabic simple" start="0">
<li>None</li>
<li>Completed</li>
<li>Started</li>
<li>Stopped</li>
</ol>
</div> </div>
<div class="section"> <div class="section">
<h2><a id="tracker-error-alert" name="tracker-error-alert">tracker_error_alert</a></h2> <h2><a id="tracker-error-alert" name="tracker-error-alert">tracker_error_alert</a></h2>

View File

@@ -3901,6 +3901,21 @@ This alert is generated each time a tracker announce is sent (or attempted to be
There are no extra data members in this alert. The url can be found in the base class There are no extra data members in this alert. The url can be found in the base class
however. however.
::
struct tracker_announce_alert: tracker_alert
{
// ...
int event;
};
Event specifies what event was sent to the tracker. It is defined as:
0. None
1. Completed
2. Started
3. Stopped
tracker_error_alert tracker_error_alert
------------------- -------------------

View File

@@ -324,16 +324,20 @@ namespace libtorrent
struct TORRENT_EXPORT tracker_announce_alert: tracker_alert struct TORRENT_EXPORT tracker_announce_alert: tracker_alert
{ {
tracker_announce_alert(torrent_handle const& h tracker_announce_alert(torrent_handle const& h
, std::string const& url) , std::string const& url, int event_)
: tracker_alert(h, url) : tracker_alert(h, url)
, event(event_)
{} {}
int event;
virtual std::auto_ptr<alert> clone() const virtual std::auto_ptr<alert> clone() const
{ return std::auto_ptr<alert>(new tracker_announce_alert(*this)); } { return std::auto_ptr<alert>(new tracker_announce_alert(*this)); }
virtual char const* what() const { return "tracker announce sent"; } virtual char const* what() const { return "tracker announce sent"; }
virtual std::string message() const virtual std::string message() const
{ {
return tracker_alert::message() + " sending announce"; const static char* event_str[] = {"none", "completed", "started", "stopped"};
return tracker_alert::message() + " sending announce (" + event_str[event] + ")";
} }
}; };

View File

@@ -1105,7 +1105,7 @@ namespace aux {
if (m_alerts.should_post<tracker_announce_alert>()) if (m_alerts.should_post<tracker_announce_alert>())
{ {
m_alerts.post_alert( m_alerts.post_alert(
tracker_announce_alert(t.get_handle(), req.url)); tracker_announce_alert(t.get_handle(), req.url, req.event));
} }
} }
@@ -1863,7 +1863,7 @@ namespace aux {
if (m_alerts.should_post<tracker_announce_alert>()) if (m_alerts.should_post<tracker_announce_alert>())
{ {
m_alerts.post_alert( m_alerts.post_alert(
tracker_announce_alert(t.get_handle(), req.url)); tracker_announce_alert(t.get_handle(), req.url, req.event));
} }
} }
#ifndef NDEBUG #ifndef NDEBUG