merged upnp fixes from trunk to RC_0_13. Added some upnp logging

This commit is contained in:
Arvid Norberg 2008-02-19 18:50:04 +00:00
parent 01c6300d51
commit bf7552a4cd
2 changed files with 19 additions and 5 deletions

View File

@ -126,8 +126,8 @@ namespace libtorrent
ifc.ifc_buf = buf;
if (ioctl(s, SIOCGIFCONF, &ifc) < 0)
{
close(s);
ec = asio::error_code(errno, asio::error::system_category);
close(s);
return ret;
}
@ -154,8 +154,8 @@ namespace libtorrent
}
else
{
close(s);
ec = asio::error_code(errno, asio::error::system_category);
close(s);
return ret;
}
}
@ -369,7 +369,6 @@ namespace libtorrent
address ret;
if (GetAdaptersInfo(adapter_info, &out_buf_size) == NO_ERROR)
{
for (PIP_ADAPTER_INFO adapter = adapter_info;
adapter != 0; adapter = adapter->Next)
{

View File

@ -256,8 +256,23 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
// this upnp device is filtered because it's not in the
// list of configured routers
#ifdef TORRENT_UPNP_LOGGING
m_log << time_now_string() << " <== (" << from << ") UPnP device "
"ignored because it's not on our network" << std::endl;
if (ec)
{
m_log << time_now_string() << " <== (" << from << ") error: "
<< ec.message() << std::endl;
}
else
{
std::vector<ip_interface> const& net = enum_net_interfaces(m_io_service, ec);
m_log << time_now_string() << " <== (" << from << ") UPnP device "
"ignored because it's not on our network ";
for (std::vector<ip_interface>::const_iterator i = net.begin()
, end(net.end()); i != end; ++i)
{
m_log << "(" << i->interface_address << ", " << i->netmask << ") ";
}
m_log << std::endl;
}
#endif
return;
}