accept port 0 in listen_interfaces
This commit is contained in:
parent
db14df5d0d
commit
089d6c3144
|
@ -1652,7 +1652,8 @@ namespace aux {
|
|||
}
|
||||
|
||||
if (ec == error_code(error::address_in_use)
|
||||
&& !(flags & listen_no_system_port))
|
||||
&& !(flags & listen_no_system_port)
|
||||
&& bind_ep.port() != 0)
|
||||
{
|
||||
// instead of giving up, try let the OS pick a port
|
||||
bind_ep.port(0);
|
||||
|
|
|
@ -279,7 +279,7 @@ namespace libtorrent
|
|||
else
|
||||
{
|
||||
iface.port = std::atoi(port.c_str());
|
||||
if (iface.port <= 0 || iface.port > 65535) iface.port = -1;
|
||||
if (iface.port < 0 || iface.port > 65535) iface.port = -1;
|
||||
}
|
||||
|
||||
// skip spaces
|
||||
|
|
|
@ -342,6 +342,10 @@ TORRENT_TEST(parse_list)
|
|||
test_parse_interface("nic :", {}, "");
|
||||
test_parse_interface("nic ", {}, "");
|
||||
test_parse_interface("nic s", {}, "");
|
||||
|
||||
// parse interface with port 0
|
||||
test_parse_interface("127.0.0.1:0"
|
||||
, {{"127.0.0.1", 0, false}}, "127.0.0.1:0");
|
||||
}
|
||||
|
||||
TORRENT_TEST(tokenize)
|
||||
|
|
Loading…
Reference in New Issue