improved error reporting on http seed failures

This commit is contained in:
Arvid Norberg
2007-03-06 23:56:17 +00:00
parent 0fe9f53410
commit b17710df09
2 changed files with 10 additions and 3 deletions

View File

@@ -2614,7 +2614,7 @@ It contains ``url`` to the HTTP seed that failed along with an error message.
struct url_seed_alert: torrent_alert 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); , const std::string& msg);
virtual std::auto_ptr<alert> clone() const; virtual std::auto_ptr<alert> clone() const;

View File

@@ -318,8 +318,15 @@ namespace libtorrent
{ {
// we should not try this server again. // we should not try this server again.
t->remove_url_seed(m_url); t->remove_url_seed(m_url);
throw std::runtime_error(boost::lexical_cast<std::string>(m_parser.status_code()) std::string error_msg = boost::lexical_cast<std::string>(m_parser.status_code())
+ " " + m_parser.message()); + " " + 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; if (!m_parser.header_finished()) break;