diff --git a/docs/manual.html b/docs/manual.html index 20b7422a3..29668f8f2 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -3798,6 +3798,20 @@ struct file_error_alert: torrent_alert

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 however.

+
+struct tracker_announce_alert: tracker_alert
+{
+        // ...
+        int event;
+};
+
+

Event specifies what event was sent to the tracker. It is defined as:

+
    +
  1. None
  2. +
  3. Completed
  4. +
  5. Started
  6. +
  7. Stopped
  8. +

tracker_error_alert

diff --git a/docs/manual.rst b/docs/manual.rst index df4cfecbb..fbc2ecb49 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -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 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 ------------------- diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index a1c556d82..61a1d6c12 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -324,16 +324,20 @@ namespace libtorrent struct TORRENT_EXPORT tracker_announce_alert: tracker_alert { tracker_announce_alert(torrent_handle const& h - , std::string const& url) + , std::string const& url, int event_) : tracker_alert(h, url) + , event(event_) {} + + int event; virtual std::auto_ptr clone() const { return std::auto_ptr(new tracker_announce_alert(*this)); } virtual char const* what() const { return "tracker announce sent"; } 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] + ")"; } }; diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 4b5669a5c..789340cd9 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1105,7 +1105,7 @@ namespace aux { if (m_alerts.should_post()) { 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()) { m_alerts.post_alert( - tracker_announce_alert(t.get_handle(), req.url)); + tracker_announce_alert(t.get_handle(), req.url, req.event)); } } #ifndef NDEBUG