This alert is generated on tracker time outs, premature disconnects, invalid response or
diff --git a/docs/manual.rst b/docs/manual.rst
index 11adf9bf7..2cd15798d 100755
--- a/docs/manual.rst
+++ b/docs/manual.rst
@@ -1802,6 +1802,25 @@ generated and the torrent is paused. It is generated as severity level ``fatal``
};
+tracker_announce_alert
+----------------------
+
+This alert is generated each time a tracker announce is sent (or attempted to be sent).
+It is generated at severity level ``info``.
+
+::
+
+ struct tracker_announce_alert: alert
+ {
+ tracker_announce_alert(
+ const torrent_handle& h
+ , const std::string& msg);
+
+ virtual std::auto_ptr clone() const;
+
+ torrent_handle handle;
+ };
+
tracker_alert
-------------
diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp
index aaddffebd..94bc4cba0 100755
--- a/include/libtorrent/alert_types.hpp
+++ b/include/libtorrent/alert_types.hpp
@@ -42,10 +42,10 @@ namespace libtorrent
{
struct tracker_alert: alert
{
- tracker_alert(const torrent_handle& h
+ tracker_alert(torrent_handle const& h
, int times
, int status
- , const std::string& msg)
+ , std::string const& msg)
: alert(alert::warning, msg)
, handle(h)
, times_in_row(times)
@@ -62,8 +62,8 @@ namespace libtorrent
struct tracker_reply_alert: alert
{
- tracker_reply_alert(const torrent_handle& h
- , const std::string& msg)
+ tracker_reply_alert(torrent_handle const& h
+ , std::string const& msg)
: alert(alert::info, msg)
, handle(h)
{}
@@ -73,13 +73,26 @@ namespace libtorrent
torrent_handle handle;
};
+
+ struct tracker_announce_alert: alert
+ {
+ tracker_announce_alert(torrent_handle const& h, std::string const& msg)
+ : alert(alert::info, msg)
+ , handle(h)
+ {}
+
+ virtual std::auto_ptr clone() const
+ { return std::auto_ptr(new tracker_announce_alert(*this)); }
+
+ torrent_handle handle;
+ };
struct hash_failed_alert: alert
{
hash_failed_alert(
- const torrent_handle& h
+ torrent_handle const& h
, int index
- , const std::string& msg)
+ , std::string const& msg)
: alert(alert::info, msg)
, handle(h)
, piece_index(index)
@@ -94,7 +107,7 @@ namespace libtorrent
struct peer_ban_alert: alert
{
- peer_ban_alert(const address& pip, torrent_handle h, const std::string& msg)
+ peer_ban_alert(address const& pip, torrent_handle h, std::string const& msg)
: alert(alert::info, msg)
, ip(pip)
, handle(h)
@@ -109,7 +122,7 @@ namespace libtorrent
struct peer_error_alert: alert
{
- peer_error_alert(address const& pip, peer_id const& pid, const std::string& msg)
+ peer_error_alert(address const& pip, peer_id const& pid, std::string const& msg)
: alert(alert::debug, msg)
, ip(pip)
, id(pid)
diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp
index 141d5eb57..6599c448e 100755
--- a/include/libtorrent/torrent_handle.hpp
+++ b/include/libtorrent/torrent_handle.hpp
@@ -261,7 +261,7 @@ namespace libtorrent
void set_download_limit(int limit);
// manually connect a peer
- void connect_peer(const address& adr) const;
+ void connect_peer(address const& adr) const;
// valid ratios are 0 (infinite ratio) or [ 1.0 , inf )
// the ratio is uploaded / downloaded. less than 1 is not allowed
diff --git a/src/session.cpp b/src/session.cpp
index af70198c6..673749a44 100755
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -381,17 +381,14 @@ namespace libtorrent { namespace detail
}
for (std::vector >::iterator i =
- writable_clients.begin();
- i != writable_clients.end();
+ writable_clients.begin(); i != writable_clients.end();
++i)
{
assert((*i)->is_writable());
}
for (std::vector >::iterator i =
- readable_clients.begin();
- i != readable_clients.end();
- ++i)
+ readable_clients.begin(); i != readable_clients.end(); ++i)
{
assert((*i)->is_readable());
}
@@ -429,9 +426,7 @@ namespace libtorrent { namespace detail
// let the writable connections send data
for (std::vector >::iterator i
- = writable_clients.begin();
- i != writable_clients.end();
- ++i)
+ = writable_clients.begin(); i != writable_clients.end(); ++i)
{
assert((*i)->is_writable());
connection_map::iterator p = m_connections.find(*i);
@@ -687,6 +682,14 @@ namespace libtorrent { namespace detail
req.listen_port = m_listen_interface.port;
req.key = m_key;
m_tracker_manager.queue_request(req, t.tracker_login());
+
+ if (m_alerts.should_post(alert::info))
+ {
+ m_alerts.post_alert(
+ tracker_announce_alert(
+ t.get_handle(), "tracker announce, event=stopped"));
+ }
+
#ifndef NDEBUG
sha1_hash i_hash = t.torrent_file().info_hash();
#endif
@@ -700,6 +703,13 @@ namespace libtorrent { namespace detail
req.listen_port = m_listen_interface.port;
req.key = m_key;
m_tracker_manager.queue_request(req, t.tracker_login(), i->second);
+
+ if (m_alerts.should_post(alert::info))
+ {
+ m_alerts.post_alert(
+ tracker_announce_alert(
+ t.get_handle(), "tracker announce"));
+ }
}
// tick() will set the used upload quota
diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp
index ef5dc5ef3..291637629 100755
--- a/src/torrent_handle.cpp
+++ b/src/torrent_handle.cpp
@@ -463,7 +463,7 @@ namespace libtorrent
, bind(&torrent::metadata, _1));
}
- void torrent_handle::connect_peer(const address& adr) const
+ void torrent_handle::connect_peer(address const& adr) const
{
INVARIANT_CHECK;