@@ -1993,7 +1994,6 @@ struct file_error_alert: alert
, const std::string& msg);
virtual std::auto_ptr<alert> clone() const;
-
torrent_handle handle;
};
@@ -2010,7 +2010,6 @@ struct tracker_announce_alert: alert
, const std::string& msg);
virtual std::auto_ptr<alert> clone() const;
-
torrent_handle handle;
};
@@ -2052,6 +2051,23 @@ struct tracker_reply_alert: alert
};
+
This alert is generated when a finished piece fails its hash check. You can get the handle
@@ -2066,7 +2082,6 @@ struct hash_failed_alert: alert
, const std::string& msg);
virtual std::auto_ptr<alert> clone() const;
-
torrent_handle handle;
int piece_index;
};
@@ -2086,7 +2101,6 @@ struct peer_ban_alert: alert
, const std::string& msg);
virtual std::auto_ptr<alert> clone() const;
-
address ip;
torrent_handle handle;
};
@@ -2106,7 +2120,6 @@ struct peer_error_alert: alert
, const std::string& msg);
virtual std::auto_ptr<alert> clone() const;
-
address ip;
peer_id id;
};
@@ -2129,7 +2142,6 @@ struct invalid_request_alert: alert
, std::string const& msg);
virtual std::auto_ptr<alert> clone() const;
-
torrent_handle handle;
address ip;
peer_request request;
@@ -2162,7 +2174,6 @@ struct torrent_finished_alert: alert
, const std::string& msg);
virtual std::auto_ptr<alert> clone() const;
-
torrent_handle handle;
};
@@ -2181,7 +2192,6 @@ struct metadata_received_alert: alert
, const std::string& msg);
virtual std::auto_ptr<alert> clone() const;
-
torrent_handle handle;
};
@@ -2198,7 +2208,6 @@ struct fastresume_rejected_alert: alert
, std::string const& msg);
virtual std::auto_ptr<alert> clone() const;
-
torrent_handle handle;
};
diff --git a/docs/manual.rst b/docs/manual.rst
index 49b962905..61abd35d8 100755
--- a/docs/manual.rst
+++ b/docs/manual.rst
@@ -1995,7 +1995,6 @@ generated and the torrent is paused. It is generated as severity level ``fatal``
, const std::string& msg);
virtual std::auto_ptr clone() const;
-
torrent_handle handle;
};
@@ -2015,7 +2014,6 @@ It is generated at severity level ``info``.
, const std::string& msg);
virtual std::auto_ptr clone() const;
-
torrent_handle handle;
};
@@ -2063,7 +2061,27 @@ succeeds. It is generated with severity level ``info``.
torrent_handle handle;
};
+tracker_warning_alert
+---------------------
+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. The message string in the alert will contain the warning message from
+the tracker. It is generated with severity level ``warning``.
+
+::
+
+ struct tracker_warning_alert: alert
+ {
+ tracker_warning_alert(torrent_handle const& h
+ , std::string const& msg);
+
+ virtual std::auto_ptr clone() const;
+ torrent_handle handle;
+ };
+
+
+
hash_failed_alert
-----------------
@@ -2081,7 +2099,6 @@ This alert is generated as severity level ``info``.
, const std::string& msg);
virtual std::auto_ptr clone() const;
-
torrent_handle handle;
int piece_index;
};
@@ -2104,7 +2121,6 @@ to the torrent that this peer was a member of.
, const std::string& msg);
virtual std::auto_ptr clone() const;
-
address ip;
torrent_handle handle;
};
@@ -2127,7 +2143,6 @@ is generated as severity level ``debug``.
, const std::string& msg);
virtual std::auto_ptr clone() const;
-
address ip;
peer_id id;
};
@@ -2153,7 +2168,6 @@ is a handle to the torrent the peer is a member of. ``
, std::string const& msg);
virtual std::auto_ptr clone() const;
-
torrent_handle handle;
address ip;
peer_request request;
@@ -2190,7 +2204,6 @@ torrent in question. This alert is generated as severity level ``info``.
, const std::string& msg);
virtual std::auto_ptr clone() const;
-
torrent_handle handle;
};
@@ -2211,7 +2224,6 @@ It is generated at severity level ``info``.
, const std::string& msg);
virtual std::auto_ptr clone() const;
-
torrent_handle handle;
};
@@ -2231,7 +2243,6 @@ resume file was rejected. It is generated at severity level ``warning``.
, std::string const& msg);
virtual std::auto_ptr clone() const;
-
torrent_handle handle;
};
diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp
index ef5ba1e04..74d49df87 100755
--- a/include/libtorrent/alert_types.hpp
+++ b/include/libtorrent/alert_types.hpp
@@ -50,7 +50,7 @@ namespace libtorrent
, handle(h)
, times_in_row(times)
, status_code(status)
- {}
+ {}
virtual std::auto_ptr clone() const
{ return std::auto_ptr(new tracker_alert(*this)); }
@@ -60,13 +60,29 @@ namespace libtorrent
int status_code;
};
+ struct tracker_warning_alert: alert
+ {
+ tracker_warning_alert(torrent_handle const& h
+ , std::string const& msg)
+ : alert(alert::warning, msg)
+ , handle(h)
+ {}
+
+ virtual std::auto_ptr clone() const
+ { return std::auto_ptr(new tracker_warning_alert(*this)); }
+
+ torrent_handle handle;
+ };
+
+
+
struct tracker_reply_alert: alert
{
tracker_reply_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_reply_alert(*this)); }
@@ -79,7 +95,7 @@ namespace libtorrent
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)); }
@@ -96,7 +112,7 @@ namespace libtorrent
: alert(alert::info, msg)
, handle(h)
, piece_index(index)
- { assert(index >= 0);}
+ { assert(index >= 0);}
virtual std::auto_ptr clone() const
{ return std::auto_ptr(new hash_failed_alert(*this)); }
@@ -239,7 +255,7 @@ namespace libtorrent
, std::string const& msg)
: alert(alert::warning, msg)
, handle(h)
- {}
+ {}
virtual std::auto_ptr clone() const
{ return std::auto_ptr(new fastresume_rejected_alert(*this)); }
diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp
index 0edbb8d95..4fe1ec728 100755
--- a/include/libtorrent/torrent.hpp
+++ b/include/libtorrent/torrent.hpp
@@ -222,6 +222,7 @@ namespace libtorrent
tracker_request const& r);
virtual void tracker_request_error(tracker_request const& r
, int response_code, const std::string& str);
+ virtual void tracker_warning(std::string const& msg);
// generates a request string for sending
// to the tracker
diff --git a/include/libtorrent/tracker_manager.hpp b/include/libtorrent/tracker_manager.hpp
index 8bc19c3ab..91352e127 100755
--- a/include/libtorrent/tracker_manager.hpp
+++ b/include/libtorrent/tracker_manager.hpp
@@ -110,6 +110,7 @@ namespace libtorrent
friend class tracker_manager;
request_callback(): m_manager(0) {}
virtual ~request_callback() {}
+ virtual void tracker_warning(std::string const& msg) = 0;
virtual void tracker_response(
tracker_request const&
, std::vector& peers
diff --git a/src/http_tracker_connection.cpp b/src/http_tracker_connection.cpp
index 0e6ccf5aa..2c3a50ebb 100755
--- a/src/http_tracker_connection.cpp
+++ b/src/http_tracker_connection.cpp
@@ -608,6 +608,14 @@ namespace libtorrent
}
catch (type_error const&) {}
+ try
+ {
+ entry const& warning = e["warning message"];
+ if (has_requester())
+ requester().tracker_warning(warning.string());
+ }
+ catch(type_error const&) {}
+
std::vector peer_list;
if (m_req.kind == tracker_request::scrape_request)
diff --git a/src/torrent.cpp b/src/torrent.cpp
index 320fd20d1..5fb5a9a42 100755
--- a/src/torrent.cpp
+++ b/src/torrent.cpp
@@ -291,6 +291,14 @@ namespace libtorrent
m_next_request < second_clock::universal_time();
}
+ void torrent::tracker_warning(std::string const& msg)
+ {
+ if (m_ses.m_alerts.should_post(alert::warning))
+ {
+ m_ses.m_alerts.post_alert(tracker_warning_alert(get_handle(), msg));
+ }
+ }
+
void torrent::tracker_response(
tracker_request const&
, std::vector& peer_list