diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index 4d82641a6..cb72cc6aa 100755 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -188,7 +188,7 @@ namespace libtorrent struct TORRENT_EXPORT peer_error_alert: alert { peer_error_alert(tcp::endpoint const& pip, peer_id const& pid_, std::string const& msg) - : alert(alert::debug, msg) + : alert(alert::info, msg) , ip(pip) , pid(pid_) {} @@ -200,6 +200,21 @@ namespace libtorrent peer_id pid; }; + struct TORRENT_EXPORT peer_disconnected_alert: alert + { + peer_disconnected_alert(tcp::endpoint const& pip, peer_id const& pid_, std::string const& msg) + : alert(alert::debug, msg) + , ip(pip) + , pid(pid_) + {} + + virtual std::auto_ptr clone() const + { return std::auto_ptr(new peer_disconnected_alert(*this)); } + + tcp::endpoint ip; + peer_id pid; + }; + struct TORRENT_EXPORT invalid_request_alert: torrent_alert { invalid_request_alert( diff --git a/include/libtorrent/peer_connection.hpp b/include/libtorrent/peer_connection.hpp index 3335f5e97..db6148653 100755 --- a/include/libtorrent/peer_connection.hpp +++ b/include/libtorrent/peer_connection.hpp @@ -247,7 +247,7 @@ namespace libtorrent void timed_out(); // this will cause this peer_connection to be disconnected. - void disconnect(char const* message); + void disconnect(char const* message, int error = 0); bool is_disconnecting() const { return m_disconnecting; } // this is called when the connection attempt has succeeded @@ -293,7 +293,6 @@ namespace libtorrent bool ignore_bandwidth_limits() const { return m_ignore_bandwidth_limits; } - void set_failed() { m_failed = true; } bool failed() const { return m_failed; } int desired_queue_size() const { return m_desired_queue_size; }