upnp fixes, improved upnp logging and error handling

This commit is contained in:
Arvid Norberg 2007-08-07 07:59:51 +00:00
parent 5dfba92665
commit 2a9d68376d
1 changed files with 35 additions and 6 deletions

View File

@ -659,7 +659,7 @@ void upnp::on_upnp_xml(asio::error_code const& e
d.upnp_connection.reset();
}
if (e)
if (e && e != asio::error::eof)
{
#ifdef TORRENT_UPNP_LOGGING
m_log << time_now_string()
@ -672,7 +672,16 @@ void upnp::on_upnp_xml(asio::error_code const& e
{
#ifdef TORRENT_UPNP_LOGGING
m_log << time_now_string()
<< " <== incomplete http message" << std::endl;
<< " <== error while fetching control url: incomplete http message" << std::endl;
#endif
return;
}
if (p.status_code() != 200)
{
#ifdef TORRENT_UPNP_LOGGING
m_log << time_now_string()
<< " <== error while fetching control url: " << p.message() << std::endl;
#endif
return;
}
@ -791,7 +800,7 @@ void upnp::on_upnp_map_response(asio::error_code const& e
d.upnp_connection.reset();
}
if (e)
if (e && e != asio::error::eof)
{
#ifdef TORRENT_UPNP_LOGGING
m_log << time_now_string()
@ -824,12 +833,22 @@ void upnp::on_upnp_map_response(asio::error_code const& e
{
#ifdef TORRENT_UPNP_LOGGING
m_log << time_now_string()
<< " <== incomplete http message" << std::endl;
<< " <== error while adding portmap: incomplete http message" << std::endl;
#endif
m_devices.erase(d);
return;
}
if (p.status_code() != 200)
{
#ifdef TORRENT_UPNP_LOGGING
m_log << time_now_string()
<< " <== error while adding portmap: " << p.message() << std::endl;
#endif
m_devices.erase(d);
return;
}
error_code_parse_state s;
xml_parse((char*)p.get_body().begin, (char*)p.get_body().end
, m_strand.wrap(bind(&find_error_code, _1, _2, boost::ref(s))));
@ -933,7 +952,7 @@ void upnp::on_upnp_unmap_response(asio::error_code const& e
d.upnp_connection.reset();
}
if (e)
if (e && e != asio::error::eof)
{
#ifdef TORRENT_UPNP_LOGGING
m_log << time_now_string()
@ -945,11 +964,21 @@ void upnp::on_upnp_unmap_response(asio::error_code const& e
{
#ifdef TORRENT_UPNP_LOGGING
m_log << time_now_string()
<< " <== incomplete http message" << std::endl;
<< " <== error while deleting portmap: incomplete http message" << std::endl;
#endif
return;
}
if (p.status_code() != 200)
{
#ifdef TORRENT_UPNP_LOGGING
m_log << time_now_string()
<< " <== error while deleting portmap: " << p.message() << std::endl;
#endif
m_devices.erase(d);
return;
}
#ifdef TORRENT_UPNP_LOGGING
m_log << time_now_string()
<< " <== unmap response: " << std::string(p.get_body().begin, p.get_body().end)