handle buggy upnp routers

This commit is contained in:
Arvid Norberg 2011-07-12 08:33:05 +00:00
parent 1ed32d2758
commit ee77b3fd04
1 changed files with 2 additions and 1 deletions

View File

@ -1295,8 +1295,9 @@ void upnp::on_upnp_map_response(error_code const& e
}
return_error(mapping, s.error_code, l);
}
else if (s.error_code == 716)
else if (s.error_code == 716 || (s.error_code == 501 && m.failcount < 4 && m.external_port == 0))
{
// some routers return 501 action failed, instead of 716
// The external port cannot be wildcarder
// pick a random port
m.external_port = 40000 + (random() % 10000);