forked from premiere/premiere-libtorrent
don't open any listen sockets if listen_interfaces is empty or misconfigured
This commit is contained in:
parent
983b1d6422
commit
c4a3937ac9
|
@ -1,3 +1,4 @@
|
||||||
|
* don't open any listen sockets if listen_interfaces is empty or misconfigured
|
||||||
* fix bug in auto disk cache size logic
|
* fix bug in auto disk cache size logic
|
||||||
* fix issue with outgoing_interfaces setting, where bind() would be called twice
|
* fix issue with outgoing_interfaces setting, where bind() would be called twice
|
||||||
* add build option to disable share-mode
|
* add build option to disable share-mode
|
||||||
|
|
|
@ -547,16 +547,14 @@ TORRENT_TEST(ipv6_support)
|
||||||
|
|
||||||
TORRENT_TEST(announce_no_listen)
|
TORRENT_TEST(announce_no_listen)
|
||||||
{
|
{
|
||||||
// if we don't listen on any sockets at all (but only make outgoing peer
|
// if we don't listen on any sockets at all we should not announce to trackers
|
||||||
// connections) we still need to make sure we announce to trackers
|
test_ipv6_support("", 0, 0);
|
||||||
test_ipv6_support("", num_interfaces * 2, num_interfaces * 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TORRENT_TEST(announce_udp_no_listen)
|
TORRENT_TEST(announce_udp_no_listen)
|
||||||
{
|
{
|
||||||
// since there's no actual udp tracker in this test, we will only try to
|
// if we don't listen on any sockets at all we should not announce to trackers
|
||||||
// announce once, and fail. We won't announce the event=stopped
|
test_udpv6_support("", 0, 0);
|
||||||
test_udpv6_support("", num_interfaces * 1, num_interfaces * 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TORRENT_TEST(ipv6_support_bind_v4_v6_any)
|
TORRENT_TEST(ipv6_support_bind_v4_v6_any)
|
||||||
|
|
|
@ -1866,14 +1866,11 @@ namespace {
|
||||||
interface_to_endpoints(iface, flags, ifs, eps);
|
interface_to_endpoints(iface, flags, ifs, eps);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no listen interfaces are specified, create sockets to use
|
|
||||||
// any interface
|
|
||||||
if (eps.empty())
|
if (eps.empty())
|
||||||
{
|
{
|
||||||
eps.emplace_back(address_v4(), 0, "", transport::plaintext
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
, listen_socket_flags_t{});
|
session_log("no listen sockets");
|
||||||
eps.emplace_back(address_v6(), 0, "", transport::plaintext
|
#endif
|
||||||
, listen_socket_flags_t{});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
expand_unspecified_address(ifs, routes, eps);
|
expand_unspecified_address(ifs, routes, eps);
|
||||||
|
@ -5004,8 +5001,6 @@ namespace {
|
||||||
if (m_interface_index >= m_outgoing_interfaces.size()) m_interface_index = 0;
|
if (m_interface_index >= m_outgoing_interfaces.size()) m_interface_index = 0;
|
||||||
std::string const& ifname = m_outgoing_interfaces[m_interface_index++];
|
std::string const& ifname = m_outgoing_interfaces[m_interface_index++];
|
||||||
|
|
||||||
if (ec) return bind_ep;
|
|
||||||
|
|
||||||
bind_ep.address(bind_socket_to_device(m_io_service, s
|
bind_ep.address(bind_socket_to_device(m_io_service, s
|
||||||
, remote_address.is_v4() ? tcp::v4() : tcp::v6()
|
, remote_address.is_v4() ? tcp::v4() : tcp::v6()
|
||||||
, ifname.c_str(), bind_ep.port(), ec));
|
, ifname.c_str(), bind_ep.port(), ec));
|
||||||
|
|
Loading…
Reference in New Issue