From b17710df098a3031275da3293f882c47fceec041 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Tue, 6 Mar 2007 23:56:17 +0000 Subject: [PATCH] improved error reporting on http seed failures --- docs/manual.rst | 2 +- src/web_peer_connection.cpp | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/manual.rst b/docs/manual.rst index c638aad5a..c036fe671 100755 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -2614,7 +2614,7 @@ It contains ``url`` to the HTTP seed that failed along with an error message. struct url_seed_alert: torrent_alert { - url_seed_alert(torrent_handle const& h, std::string const& h + url_seed_alert(torrent_handle const& h, std::string const& url , const std::string& msg); virtual std::auto_ptr clone() const; diff --git a/src/web_peer_connection.cpp b/src/web_peer_connection.cpp index c49aa1d0b..1789960a5 100755 --- a/src/web_peer_connection.cpp +++ b/src/web_peer_connection.cpp @@ -318,8 +318,15 @@ namespace libtorrent { // we should not try this server again. t->remove_url_seed(m_url); - throw std::runtime_error(boost::lexical_cast(m_parser.status_code()) - + " " + m_parser.message()); + std::string error_msg = boost::lexical_cast(m_parser.status_code()) + + " " + m_parser.message(); + if (m_ses.m_alerts.should_post(alert::warning)) + { + session_impl::mutex_t::scoped_lock l(m_ses.m_mutex); + m_ses.m_alerts.post_alert(url_seed_alert(t->get_handle(), url() + , error_msg)); + } + throw std::runtime_error(error_msg); } if (!m_parser.header_finished()) break;