diff --git a/ChangeLog b/ChangeLog index 50667bee3..45a59239e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -78,6 +78,7 @@ * resume data no longer has timestamps of files * require C++11 to build libtorrent + * fix IPv6 tracker announce issue * restore path sanitization behavior of ":" * fix listen socket issue when disabling "force_proxy" mode * fix full allocation failure on APFS diff --git a/include/libtorrent/http_connection.hpp b/include/libtorrent/http_connection.hpp index 49e3aea3d..ef8ef1f06 100644 --- a/include/libtorrent/http_connection.hpp +++ b/include/libtorrent/http_connection.hpp @@ -33,11 +33,6 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef TORRENT_HTTP_CONNECTION #define TORRENT_HTTP_CONNECTION -#include "libtorrent/aux_/disable_warnings_push.hpp" - -#include -#include - #ifdef TORRENT_USE_OPENSSL // there is no forward declaration header for asio namespace boost { @@ -49,8 +44,6 @@ namespace ssl { } #endif -#include "libtorrent/aux_/disable_warnings_pop.hpp" - #include #include #include @@ -64,6 +57,7 @@ namespace ssl { #include "libtorrent/i2p_stream.hpp" #include "libtorrent/aux_/vector.hpp" #include "libtorrent/resolver_interface.hpp" +#include "libtorrent/optional.hpp" namespace libtorrent { @@ -83,7 +77,6 @@ typedef std::function&)> http_ // will always be 0 struct TORRENT_EXTRA_EXPORT http_connection : std::enable_shared_from_this - , boost::noncopyable { http_connection(io_service& ios , resolver_interface& resolver @@ -97,6 +90,10 @@ struct TORRENT_EXTRA_EXPORT http_connection #endif ); + // non-copyable + http_connection(http_connection const&) = delete; + http_connection& operator=(http_connection const&) = delete; + virtual ~http_connection(); void rate_limit(int limit); @@ -195,7 +192,7 @@ private: // configured to use a proxy aux::proxy_settings m_proxy; - // the address to bind to + // the address to bind to. unset means do not bind boost::optional
m_bind_addr; // if username password was passed in, remember it in case we need to diff --git a/simulation/setup_dht.cpp b/simulation/setup_dht.cpp index 05361b52b..bba91a0bc 100644 --- a/simulation/setup_dht.cpp +++ b/simulation/setup_dht.cpp @@ -140,7 +140,7 @@ struct dht_node final : lt::dht::socket_manager // since the simulation is single threaded, we can get away with just // allocating a single of these static bdecode_node msg; - int ret = bdecode(m_buffer, m_buffer + bytes_transferred, msg, err, &pos, 10, 500); + int const ret = bdecode(m_buffer, m_buffer + bytes_transferred, msg, err, &pos, 10, 500); if (ret != 0) return; if (msg.type() != bdecode_node::dict_t) return; diff --git a/simulation/test_http_connection.cpp b/simulation/test_http_connection.cpp index 8185dbce3..9e69f1bfd 100644 --- a/simulation/test_http_connection.cpp +++ b/simulation/test_http_connection.cpp @@ -178,7 +178,7 @@ std::shared_ptr test_request(io_service& ios std::printf("CONNECTED: %s\n", url.c_str()); }); - h->get(url, seconds(1), 0, &ps, 5, "test/user-agent", boost::optional
() + h->get(url, seconds(1), 0, &ps, 5, "test/user-agent", boost::none , resolver_flags{}, auth); return h; } diff --git a/simulation/test_tracker.cpp b/simulation/test_tracker.cpp index f2c0dfe00..713584fcf 100644 --- a/simulation/test_tracker.cpp +++ b/simulation/test_tracker.cpp @@ -323,25 +323,30 @@ void test_ipv6_support(char const* listen_interfaces int v4_announces = 0; int v6_announces = 0; + // if we're not listening we'll just report port 0 + std::string const expect_port = (listen_interfaces && listen_interfaces == ""_sv) + ? "&port=0" : "&port=6881"; + http_v4.register_handler("/announce" - , [&v4_announces](std::string method, std::string req + , [&v4_announces,expect_port](std::string method, std::string req , std::map&) { ++v4_announces; TEST_EQUAL(method, "GET"); - + TEST_CHECK(req.find(expect_port) != std::string::npos); char response[500]; int const size = std::snprintf(response, sizeof(response), "d8:intervali1800e5:peers0:e"); return sim::send_response(200, "OK", size) + response; }); http_v6.register_handler("/announce" - , [&v6_announces](std::string method, std::string req + , [&v6_announces,expect_port](std::string method, std::string req , std::map&) { ++v6_announces; TEST_EQUAL(method, "GET"); + TEST_CHECK(req.find(expect_port) != std::string::npos); char response[500]; int const size = std::snprintf(response, sizeof(response), "d8:intervali1800e5:peers0:e"); return sim::send_response(200, "OK", size) + response; diff --git a/src/torrent.cpp b/src/torrent.cpp index ae16fcf08..118c583b5 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -2745,7 +2745,6 @@ namespace libtorrent { && m_torrent_file && m_torrent_file->priv()) { - m_ses.for_each_listen_socket([&](aux::listen_socket_handle const& s) { if (s.is_ssl() != is_ssl_torrent()) @@ -3158,28 +3157,10 @@ namespace libtorrent { "external ip: %s\n" "resolved to: %s\n" "we connected to: %s\n" - "peers:" , interval.count() , print_address(resp.external_ip).c_str() , resolved_to.c_str() , print_address(tracker_ip).c_str()); - - for (auto const& i : resp.peers) - { - debug_log(" %16s %5d %s %s", i.hostname.c_str(), i.port - , i.pid.is_all_zeros()?"":aux::to_hex(i.pid).c_str() - , identify_client(i.pid).c_str()); - } - for (auto const& i : resp.peers4) - { - debug_log(" %s:%d", print_address(address_v4(i.ip)).c_str(), i.port); - } -#if TORRENT_USE_IPV6 - for (auto const& i : resp.peers6) - { - debug_log(" [%s]:%d", print_address(address_v6(i.ip)).c_str(), i.port); - } -#endif } #else TORRENT_UNUSED(tracker_ips); diff --git a/src/tracker_manager.cpp b/src/tracker_manager.cpp index a0122202c..d563cd70c 100644 --- a/src/tracker_manager.cpp +++ b/src/tracker_manager.cpp @@ -266,6 +266,12 @@ namespace libtorrent { if (req.event == tracker_request::stopped) req.num_want = 0; +#ifndef TORRENT_DISABLE_LOGGING + std::shared_ptr cb = c.lock(); + if (cb) cb->debug_log("*** QUEUE_TRACKER_REQUEST [ listen_port: %d ]" + , req.listen_port); +#endif + TORRENT_ASSERT(!m_abort || req.event == tracker_request::stopped); if (m_abort && req.event != tracker_request::stopped) return; diff --git a/src/udp_tracker_connection.cpp b/src/udp_tracker_connection.cpp index 161214c90..8651b0fa3 100644 --- a/src/udp_tracker_connection.cpp +++ b/src/udp_tracker_connection.cpp @@ -280,7 +280,7 @@ namespace libtorrent { char const* bind_address_type = bind_interface().is_v4() ? "IPv4" : "IPv6"; char msg[200]; std::snprintf(msg, sizeof(msg) - , "the tracker only resolves to an %s address, and you're " + , "the tracker only resolves to an %s address, and you're " "listening on an %s socket. This may prevent you from receiving " "incoming connections." , tracker_address_type, bind_address_type); diff --git a/test/test_http_connection.cpp b/test/test_http_connection.cpp index 763316703..86cab4dac 100644 --- a/test/test_http_connection.cpp +++ b/test/test_http_connection.cpp @@ -120,8 +120,7 @@ void run_test(std::string const& url, int size, int status, int connected std::shared_ptr h = std::make_shared(ios , res, &::http_handler, true, 1024*1024, &::http_connect_handler); - h->get(url, seconds(1), 0, &ps, 5, "test/user-agent", address(address_v4::any()) - , resolver_flags{}, auth); + h->get(url, seconds(1), 0, &ps, 5, "test/user-agent", boost::none, resolver_flags{}, auth); ios.reset(); error_code e; ios.run(e);