Skip to content

Commit 4bc93cf

Browse files
committed
merge RC_1_1 into master
2 parents f73473a + 5e76665 commit 4bc93cf

9 files changed

+25
-36
lines changed

ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
* resume data no longer has timestamps of files
7979
* require C++11 to build libtorrent
8080

81+
* fix IPv6 tracker announce issue
8182
* restore path sanitization behavior of ":"
8283
* fix listen socket issue when disabling "force_proxy" mode
8384
* fix full allocation failure on APFS

include/libtorrent/http_connection.hpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
3333
#ifndef TORRENT_HTTP_CONNECTION
3434
#define TORRENT_HTTP_CONNECTION
3535

36-
#include "libtorrent/aux_/disable_warnings_push.hpp"
37-
38-
#include <boost/noncopyable.hpp>
39-
#include <boost/optional.hpp>
40-
4136
#ifdef TORRENT_USE_OPENSSL
4237
// there is no forward declaration header for asio
4338
namespace boost {
@@ -49,8 +44,6 @@ namespace ssl {
4944
}
5045
#endif
5146

52-
#include "libtorrent/aux_/disable_warnings_pop.hpp"
53-
5447
#include <functional>
5548
#include <vector>
5649
#include <string>
@@ -64,6 +57,7 @@ namespace ssl {
6457
#include "libtorrent/i2p_stream.hpp"
6558
#include "libtorrent/aux_/vector.hpp"
6659
#include "libtorrent/resolver_interface.hpp"
60+
#include "libtorrent/optional.hpp"
6761

6862
namespace libtorrent {
6963

@@ -83,7 +77,6 @@ typedef std::function<void(http_connection&, std::vector<tcp::endpoint>&)> http_
8377
// will always be 0
8478
struct TORRENT_EXTRA_EXPORT http_connection
8579
: std::enable_shared_from_this<http_connection>
86-
, boost::noncopyable
8780
{
8881
http_connection(io_service& ios
8982
, resolver_interface& resolver
@@ -97,6 +90,10 @@ struct TORRENT_EXTRA_EXPORT http_connection
9790
#endif
9891
);
9992

93+
// non-copyable
94+
http_connection(http_connection const&) = delete;
95+
http_connection& operator=(http_connection const&) = delete;
96+
10097
virtual ~http_connection();
10198

10299
void rate_limit(int limit);
@@ -195,7 +192,7 @@ struct TORRENT_EXTRA_EXPORT http_connection
195192
// configured to use a proxy
196193
aux::proxy_settings m_proxy;
197194

198-
// the address to bind to
195+
// the address to bind to. unset means do not bind
199196
boost::optional<address> m_bind_addr;
200197

201198
// if username password was passed in, remember it in case we need to

simulation/setup_dht.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ struct dht_node final : lt::dht::socket_manager
140140
// since the simulation is single threaded, we can get away with just
141141
// allocating a single of these
142142
static bdecode_node msg;
143-
int ret = bdecode(m_buffer, m_buffer + bytes_transferred, msg, err, &pos, 10, 500);
143+
int const ret = bdecode(m_buffer, m_buffer + bytes_transferred, msg, err, &pos, 10, 500);
144144
if (ret != 0) return;
145145

146146
if (msg.type() != bdecode_node::dict_t) return;

simulation/test_http_connection.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ std::shared_ptr<http_connection> test_request(io_service& ios
178178
std::printf("CONNECTED: %s\n", url.c_str());
179179
});
180180

181-
h->get(url, seconds(1), 0, &ps, 5, "test/user-agent", boost::optional<address>()
181+
h->get(url, seconds(1), 0, &ps, 5, "test/user-agent", boost::none
182182
, resolver_flags{}, auth);
183183
return h;
184184
}

simulation/test_tracker.cpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -323,25 +323,30 @@ void test_ipv6_support(char const* listen_interfaces
323323
int v4_announces = 0;
324324
int v6_announces = 0;
325325

326+
// if we're not listening we'll just report port 0
327+
std::string const expect_port = (listen_interfaces && listen_interfaces == ""_sv)
328+
? "&port=0" : "&port=6881";
329+
326330
http_v4.register_handler("/announce"
327-
, [&v4_announces](std::string method, std::string req
331+
, [&v4_announces,expect_port](std::string method, std::string req
328332
, std::map<std::string, std::string>&)
329333
{
330334
++v4_announces;
331335
TEST_EQUAL(method, "GET");
332-
336+
TEST_CHECK(req.find(expect_port) != std::string::npos);
333337
char response[500];
334338
int const size = std::snprintf(response, sizeof(response), "d8:intervali1800e5:peers0:e");
335339
return sim::send_response(200, "OK", size) + response;
336340
});
337341

338342
http_v6.register_handler("/announce"
339-
, [&v6_announces](std::string method, std::string req
343+
, [&v6_announces,expect_port](std::string method, std::string req
340344
, std::map<std::string, std::string>&)
341345
{
342346
++v6_announces;
343347
TEST_EQUAL(method, "GET");
344348

349+
TEST_CHECK(req.find(expect_port) != std::string::npos);
345350
char response[500];
346351
int const size = std::snprintf(response, sizeof(response), "d8:intervali1800e5:peers0:e");
347352
return sim::send_response(200, "OK", size) + response;

src/torrent.cpp

-19
Original file line numberDiff line numberDiff line change
@@ -2745,7 +2745,6 @@ namespace libtorrent {
27452745
&& m_torrent_file
27462746
&& m_torrent_file->priv())
27472747
{
2748-
27492748
m_ses.for_each_listen_socket([&](aux::listen_socket_handle const& s)
27502749
{
27512750
if (s.is_ssl() != is_ssl_torrent())
@@ -3158,28 +3157,10 @@ namespace libtorrent {
31583157
"external ip: %s\n"
31593158
"resolved to: %s\n"
31603159
"we connected to: %s\n"
3161-
"peers:"
31623160
, interval.count()
31633161
, print_address(resp.external_ip).c_str()
31643162
, resolved_to.c_str()
31653163
, print_address(tracker_ip).c_str());
3166-
3167-
for (auto const& i : resp.peers)
3168-
{
3169-
debug_log(" %16s %5d %s %s", i.hostname.c_str(), i.port
3170-
, i.pid.is_all_zeros()?"":aux::to_hex(i.pid).c_str()
3171-
, identify_client(i.pid).c_str());
3172-
}
3173-
for (auto const& i : resp.peers4)
3174-
{
3175-
debug_log(" %s:%d", print_address(address_v4(i.ip)).c_str(), i.port);
3176-
}
3177-
#if TORRENT_USE_IPV6
3178-
for (auto const& i : resp.peers6)
3179-
{
3180-
debug_log(" [%s]:%d", print_address(address_v6(i.ip)).c_str(), i.port);
3181-
}
3182-
#endif
31833164
}
31843165
#else
31853166
TORRENT_UNUSED(tracker_ips);

src/tracker_manager.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ namespace libtorrent {
266266
if (req.event == tracker_request::stopped)
267267
req.num_want = 0;
268268

269+
#ifndef TORRENT_DISABLE_LOGGING
270+
std::shared_ptr<request_callback> cb = c.lock();
271+
if (cb) cb->debug_log("*** QUEUE_TRACKER_REQUEST [ listen_port: %d ]"
272+
, req.listen_port);
273+
#endif
274+
269275
TORRENT_ASSERT(!m_abort || req.event == tracker_request::stopped);
270276
if (m_abort && req.event != tracker_request::stopped)
271277
return;

src/udp_tracker_connection.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ namespace libtorrent {
280280
char const* bind_address_type = bind_interface().is_v4() ? "IPv4" : "IPv6";
281281
char msg[200];
282282
std::snprintf(msg, sizeof(msg)
283-
, "the tracker only resolves to an %s address, and you're "
283+
, "the tracker only resolves to an %s address, and you're "
284284
"listening on an %s socket. This may prevent you from receiving "
285285
"incoming connections."
286286
, tracker_address_type, bind_address_type);

test/test_http_connection.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,7 @@ void run_test(std::string const& url, int size, int status, int connected
120120

121121
std::shared_ptr<http_connection> h = std::make_shared<http_connection>(ios
122122
, res, &::http_handler, true, 1024*1024, &::http_connect_handler);
123-
h->get(url, seconds(1), 0, &ps, 5, "test/user-agent", address(address_v4::any())
124-
, resolver_flags{}, auth);
123+
h->get(url, seconds(1), 0, &ps, 5, "test/user-agent", boost::none, resolver_flags{}, auth);
125124
ios.reset();
126125
error_code e;
127126
ios.run(e);

0 commit comments

Comments
 (0)