forked from premiere/premiere-libtorrent
slight upnp optimization
This commit is contained in:
parent
2d4bdbca7d
commit
aeee715dd6
41
src/upnp.cpp
41
src/upnp.cpp
|
@ -353,30 +353,33 @@ void upnp::on_reply(udp::endpoint const& from, char* buffer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ip_route> routes = enum_routes(m_io_service, ec);
|
if (m_ignore_non_routers)
|
||||||
if (m_ignore_non_routers && std::find_if(routes.begin(), routes.end()
|
|
||||||
, bind(&ip_route::gateway, _1) == from.address()) == routes.end())
|
|
||||||
{
|
{
|
||||||
// this upnp device is filtered because it's not in the
|
std::vector<ip_route> routes = enum_routes(m_io_service, ec);
|
||||||
// list of configured routers
|
if (std::find_if(routes.begin(), routes.end()
|
||||||
if (ec)
|
, bind(&ip_route::gateway, _1) == from.address()) == routes.end())
|
||||||
{
|
{
|
||||||
std::stringstream msg;
|
// this upnp device is filtered because it's not in the
|
||||||
msg << "when receiving response from: " << from << ": " << ec.message();
|
// list of configured routers
|
||||||
log(msg.str());
|
if (ec)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::stringstream msg;
|
|
||||||
msg << "ignoring response from: " << from << ". IP is not a router. ";
|
|
||||||
for (std::vector<ip_route>::const_iterator i = routes.begin()
|
|
||||||
, end(routes.end()); i != end; ++i)
|
|
||||||
{
|
{
|
||||||
msg << "(" << i->gateway << ", " << i->netmask << ") ";
|
std::stringstream msg;
|
||||||
|
msg << "when receiving response from: " << from << ": " << ec.message();
|
||||||
|
log(msg.str());
|
||||||
}
|
}
|
||||||
log(msg.str());
|
else
|
||||||
|
{
|
||||||
|
std::stringstream msg;
|
||||||
|
msg << "ignoring response from: " << from << ". IP is not a router. ";
|
||||||
|
for (std::vector<ip_route>::const_iterator i = routes.begin()
|
||||||
|
, end(routes.end()); i != end; ++i)
|
||||||
|
{
|
||||||
|
msg << "(" << i->gateway << ", " << i->netmask << ") ";
|
||||||
|
}
|
||||||
|
log(msg.str());
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
http_parser p;
|
http_parser p;
|
||||||
|
|
Loading…
Reference in New Issue