forked from premiere/premiere-libtorrent
merge RC_1_1 into master
This commit is contained in:
commit
4bc93cff38
|
@ -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
|
||||
|
|
|
@ -33,11 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_HTTP_CONNECTION
|
||||
#define TORRENT_HTTP_CONNECTION
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#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 <functional>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
@ -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<void(http_connection&, std::vector<tcp::endpoint>&)> http_
|
|||
// will always be 0
|
||||
struct TORRENT_EXTRA_EXPORT http_connection
|
||||
: std::enable_shared_from_this<http_connection>
|
||||
, 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<address> m_bind_addr;
|
||||
|
||||
// if username password was passed in, remember it in case we need to
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -178,7 +178,7 @@ std::shared_ptr<http_connection> 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<address>()
|
||||
h->get(url, seconds(1), 0, &ps, 5, "test/user-agent", boost::none
|
||||
, resolver_flags{}, auth);
|
||||
return h;
|
||||
}
|
||||
|
|
|
@ -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<std::string, std::string>&)
|
||||
{
|
||||
++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<std::string, std::string>&)
|
||||
{
|
||||
++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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -266,6 +266,12 @@ namespace libtorrent {
|
|||
if (req.event == tracker_request::stopped)
|
||||
req.num_want = 0;
|
||||
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
std::shared_ptr<request_callback> 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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -120,8 +120,7 @@ void run_test(std::string const& url, int size, int status, int connected
|
|||
|
||||
std::shared_ptr<http_connection> h = std::make_shared<http_connection>(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);
|
||||
|
|
Loading…
Reference in New Issue