fix warnings and no-deprecated functions build
This commit is contained in:
parent
4b1d3485ab
commit
990aabe36f
6
Jamfile
6
Jamfile
|
@ -265,6 +265,7 @@ rule warnings ( properties * )
|
|||
result += <cflags>-Wno-weak-vtables ;
|
||||
result += <cflags>-Wno-sign-compare ;
|
||||
result += <cflags>-Wno-sign-conversion ;
|
||||
result += <cflags>-Wno-conversion ;
|
||||
}
|
||||
|
||||
if <toolset>gcc in $(properties)
|
||||
|
@ -502,8 +503,8 @@ feature export-extra : off on : composite propagated ;
|
|||
# making it possible to build on windows, especially mingw seems particular
|
||||
# for release builds, disable optimizations as they bump GCC over the edge of
|
||||
# allowed memory usage on travis-ci
|
||||
variant test_release
|
||||
: release : <asserts>production <debug-symbols>on
|
||||
variant test_release : release
|
||||
: <asserts>production <debug-symbols>on
|
||||
<invariant-checks>full <boost-link>shared <optimization>off
|
||||
<export-extra>on <debug-iterators>on <threading>multi
|
||||
;
|
||||
|
@ -519,7 +520,6 @@ variant test_barebones : debug
|
|||
<export-extra>on <debug-iterators>on <threading>multi
|
||||
;
|
||||
|
||||
|
||||
# required for openssl on windows
|
||||
lib ssleay32 : : <name>ssleay32 ;
|
||||
lib libeay32 : : <name>libeay32 ;
|
||||
|
|
|
@ -208,6 +208,9 @@ namespace libtorrent {
|
|||
alert();
|
||||
// hidden
|
||||
virtual ~alert();
|
||||
#if __cplusplus >= 201103L
|
||||
alert(alert const& st) = default;
|
||||
#endif
|
||||
|
||||
// a timestamp is automatically created in the constructor
|
||||
time_point timestamp() const;
|
||||
|
|
|
@ -63,7 +63,7 @@ template <typename Handle>
|
|||
void sync_call_handle(Handle& h, boost::function<void(void)> f)
|
||||
{
|
||||
bool done = false;
|
||||
session_impl& ses = (session_impl&) h->session();
|
||||
session_impl& ses = static_cast<session_impl&>(h->session());
|
||||
ses.get_io_service().dispatch(boost::bind(&aux::fun_wrap
|
||||
, boost::ref(done)
|
||||
, boost::ref(ses.cond)
|
||||
|
@ -91,7 +91,7 @@ template <typename Handle, typename Ret>
|
|||
void sync_call_ret_handle(Handle& h, Ret& r, boost::function<Ret(void)> f)
|
||||
{
|
||||
bool done = false;
|
||||
session_impl& ses = (session_impl&) h->session();
|
||||
session_impl& ses = static_cast<session_impl&>(h->session());
|
||||
ses.get_io_service().dispatch(boost::bind(&aux::fun_ret<Ret>
|
||||
, boost::ref(r)
|
||||
, boost::ref(done)
|
||||
|
@ -105,3 +105,4 @@ void sync_call_ret_handle(Handle& h, Ret& r, boost::function<Ret(void)> f)
|
|||
} } // namespace aux namespace libtorrent
|
||||
|
||||
#endif // TORRENT_SESSION_CALL_HPP_INCLUDED
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ namespace libtorrent
|
|||
write_char(out, 'e');
|
||||
ret += 2;
|
||||
break;
|
||||
default:
|
||||
case entry::undefined_t:
|
||||
// trying to encode a structure with uninitialized values!
|
||||
// TORRENT_ASSERT_VAL(false, e.type());
|
||||
// do nothing
|
||||
|
|
|
@ -98,7 +98,7 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_ASSERT(index >= 0);
|
||||
TORRENT_ASSERT(index < size());
|
||||
return (m_buf[index / 32] & htonl((0x80000000 >> (index & 31)))) != 0;
|
||||
return (m_buf[index / 32] & host_to_network((0x80000000 >> (index & 31)))) != 0;
|
||||
}
|
||||
|
||||
// set bit at ``index`` to 0 (clear_bit) or 1 (set_bit).
|
||||
|
@ -106,13 +106,13 @@ namespace libtorrent
|
|||
{
|
||||
TORRENT_ASSERT(index >= 0);
|
||||
TORRENT_ASSERT(index < size());
|
||||
m_buf[index / 32] &= htonl(~(0x80000000 >> (index & 31)));
|
||||
m_buf[index / 32] &= host_to_network(~(0x80000000 >> (index & 31)));
|
||||
}
|
||||
void set_bit(int index)
|
||||
{
|
||||
TORRENT_ASSERT(index >= 0);
|
||||
TORRENT_ASSERT(index < size());
|
||||
m_buf[index / 32] |= htonl((0x80000000 >> (index & 31)));
|
||||
m_buf[index / 32] |= host_to_network((0x80000000 >> (index & 31)));
|
||||
}
|
||||
|
||||
// returns true if all bits in the bitfield are set
|
||||
|
@ -126,7 +126,7 @@ namespace libtorrent
|
|||
int rest = size() & 31;
|
||||
if (rest > 0)
|
||||
{
|
||||
boost::uint32_t mask = htonl(0xffffffff << (32-rest));
|
||||
boost::uint32_t mask = host_to_network(0xffffffff << (32-rest));
|
||||
if ((m_buf[words] & mask) != mask) return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -223,7 +223,7 @@ namespace libtorrent
|
|||
typedef bool& reference;
|
||||
typedef std::forward_iterator_tag iterator_category;
|
||||
|
||||
bool operator*() { return (*buf & htonl(bit)) != 0; }
|
||||
bool operator*() { return (*buf & host_to_network(bit)) != 0; }
|
||||
const_iterator& operator++() { inc(); return *this; }
|
||||
const_iterator operator++(int)
|
||||
{ const_iterator ret(*this); inc(); return ret; }
|
||||
|
@ -289,7 +289,7 @@ namespace libtorrent
|
|||
int new_size_words = num_words();
|
||||
if (val)
|
||||
{
|
||||
if (old_size_words && b) m_buf[old_size_words - 1] |= htonl((0xffffffff >> b));
|
||||
if (old_size_words && b) m_buf[old_size_words - 1] |= host_to_network((0xffffffff >> b));
|
||||
if (old_size_words < new_size_words)
|
||||
std::memset(m_buf + old_size_words, 0xff
|
||||
, size_t((new_size_words - old_size_words) * 4));
|
||||
|
@ -357,7 +357,7 @@ namespace libtorrent
|
|||
void clear_trailing_bits()
|
||||
{
|
||||
// clear the tail bits in the last byte
|
||||
if (size() & 31) m_buf[num_words() - 1] &= htonl(0xffffffff << (32 - (size() & 31)));
|
||||
if (size() & 31) m_buf[num_words() - 1] &= host_to_network(0xffffffff << (32 - (size() & 31)));
|
||||
}
|
||||
|
||||
void dealloc()
|
||||
|
|
|
@ -38,6 +38,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/config.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#ifdef TORRENT_WINDOWS
|
||||
#include <Winsock2.h>
|
||||
#else
|
||||
|
@ -46,5 +50,21 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
// these need to be within the disabled warnings because on OSX
|
||||
// the htonl and ntohl macros cause lots of old-style case warnings
|
||||
inline boost::uint32_t host_to_network(boost::uint32_t x)
|
||||
{ return htonl(x); }
|
||||
|
||||
inline boost::uint32_t network_to_host(boost::uint32_t x)
|
||||
{ return ntohl(x); }
|
||||
|
||||
inline boost::uint16_t host_to_network(boost::uint16_t x)
|
||||
{ return htons(x); }
|
||||
|
||||
inline boost::uint16_t network_to_host(boost::uint16_t x)
|
||||
{ return ntohs(x); }
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#endif // TORRENT_BYTESWAP_HPP_INCLUDED
|
||||
|
||||
|
|
|
@ -37,9 +37,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/assert.hpp"
|
||||
#include "libtorrent/disk_io_job.hpp" // for block_cache_reference
|
||||
#include <algorithm>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
struct disk_io_thread;
|
||||
|
|
|
@ -508,6 +508,10 @@ namespace libtorrent
|
|||
libtorrent_exception(error_code const& s): m_error(s), m_msg(0) {}
|
||||
virtual const char* what() const TORRENT_EXCEPTION_THROW_SPECIFIER;
|
||||
virtual ~libtorrent_exception() TORRENT_EXCEPTION_THROW_SPECIFIER;
|
||||
#if __cplusplus >= 201103L
|
||||
libtorrent_exception(libtorrent_exception const& st) = default;
|
||||
libtorrent_exception& operator=(libtorrent_exception const& st) = default;
|
||||
#endif
|
||||
error_code error() const { return m_error; }
|
||||
private:
|
||||
error_code m_error;
|
||||
|
|
|
@ -60,6 +60,10 @@ namespace libtorrent
|
|||
file_entry();
|
||||
// hidden
|
||||
~file_entry();
|
||||
#if __cplusplus >= 201103L
|
||||
file_entry(file_entry const& st) = default;
|
||||
file_entry& operator=(file_entry const& st) = default;
|
||||
#endif
|
||||
|
||||
// the full path of this file. The paths are unicode strings
|
||||
// encoded in UTF-8.
|
||||
|
|
|
@ -35,8 +35,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "libtorrent/entry.hpp"
|
||||
#include <vector>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
#include <boost/smart_ptr.hpp>
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
// OVERVIEW
|
||||
//
|
||||
// You have some control over session configuration through the session::apply_settings()
|
||||
|
|
|
@ -154,16 +154,16 @@ namespace libtorrent
|
|||
// byte order, so they have to be byteswapped before
|
||||
// applying the shift operations, and then byteswapped
|
||||
// back again.
|
||||
m_number[0] = ntohl(m_number[0]);
|
||||
m_number[0] = network_to_host(m_number[0]);
|
||||
for (int i = 0; i < number_size - 1; ++i)
|
||||
{
|
||||
m_number[i] <<= n;
|
||||
m_number[i+1] = ntohl(m_number[i+1]);
|
||||
m_number[i+1] = network_to_host(m_number[i+1]);
|
||||
m_number[i] |= m_number[i+1] >> (32 - n);
|
||||
m_number[i] = htonl(m_number[i]);
|
||||
m_number[i] = host_to_network(m_number[i]);
|
||||
}
|
||||
m_number[number_size-1] <<= n;
|
||||
m_number[number_size-1] = htonl(m_number[number_size-1]);
|
||||
m_number[number_size-1] = host_to_network(m_number[number_size-1]);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -191,17 +191,17 @@ namespace libtorrent
|
|||
// byte order, so they have to be byteswapped before
|
||||
// applying the shift operations, and then byteswapped
|
||||
// back again.
|
||||
m_number[number_size-1] = ntohl(m_number[number_size-1]);
|
||||
m_number[number_size-1] = network_to_host(m_number[number_size-1]);
|
||||
|
||||
for (int i = number_size - 1; i > 0; --i)
|
||||
{
|
||||
m_number[i] >>= n;
|
||||
m_number[i-1] = ntohl(m_number[i-1]);
|
||||
m_number[i-1] = network_to_host(m_number[i-1]);
|
||||
m_number[i] |= (m_number[i-1] << (32 - n)) & 0xffffffff;
|
||||
m_number[i] = htonl(m_number[i]);
|
||||
m_number[i] = host_to_network(m_number[i]);
|
||||
}
|
||||
m_number[0] >>= n;
|
||||
m_number[0] = htonl(m_number[0]);
|
||||
m_number[0] = host_to_network(m_number[0]);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -219,8 +219,8 @@ namespace libtorrent
|
|||
{
|
||||
for (int i = 0; i < number_size; ++i)
|
||||
{
|
||||
boost::uint32_t lhs = ntohl(m_number[i]);
|
||||
boost::uint32_t rhs = ntohl(n.m_number[i]);
|
||||
boost::uint32_t lhs = network_to_host(m_number[i]);
|
||||
boost::uint32_t rhs = network_to_host(n.m_number[i]);
|
||||
if (lhs < rhs) return true;
|
||||
if (lhs > rhs) return false;
|
||||
}
|
||||
|
@ -277,30 +277,30 @@ namespace libtorrent
|
|||
}
|
||||
|
||||
// accessors for specific bytes
|
||||
unsigned char& operator[](int i)
|
||||
boost::uint8_t& operator[](int i)
|
||||
{
|
||||
TORRENT_ASSERT(i >= 0 && i < size);
|
||||
return reinterpret_cast<unsigned char*>(m_number)[i];
|
||||
return reinterpret_cast<boost::uint8_t*>(m_number)[i];
|
||||
}
|
||||
unsigned char const& operator[](int i) const
|
||||
boost::uint8_t const& operator[](int i) const
|
||||
{
|
||||
TORRENT_ASSERT(i >= 0 && i < size);
|
||||
return reinterpret_cast<unsigned char const*>(m_number)[i];
|
||||
return reinterpret_cast<boost::uint8_t const*>(m_number)[i];
|
||||
}
|
||||
|
||||
typedef const unsigned char* const_iterator;
|
||||
typedef unsigned char* iterator;
|
||||
typedef const boost::uint8_t* const_iterator;
|
||||
typedef boost::uint8_t* iterator;
|
||||
|
||||
// start and end iterators for the hash. The value type
|
||||
// of these iterators is ``unsigned char``.
|
||||
// of these iterators is ``boost::uint8_t``.
|
||||
const_iterator begin() const
|
||||
{ return reinterpret_cast<unsigned char const*>(m_number); }
|
||||
{ return reinterpret_cast<boost::uint8_t const*>(m_number); }
|
||||
const_iterator end() const
|
||||
{ return reinterpret_cast<unsigned char const*>(m_number) + size; }
|
||||
{ return reinterpret_cast<boost::uint8_t const*>(m_number) + size; }
|
||||
iterator begin()
|
||||
{ return reinterpret_cast<unsigned char*>(m_number); }
|
||||
{ return reinterpret_cast<boost::uint8_t*>(m_number); }
|
||||
iterator end()
|
||||
{ return reinterpret_cast<unsigned char*>(m_number) + size; }
|
||||
{ return reinterpret_cast<boost::uint8_t*>(m_number) + size; }
|
||||
|
||||
// return a copy of the 20 bytes representing the sha1-hash as a std::string.
|
||||
// It's still a binary string with 20 binary characters.
|
||||
|
|
|
@ -33,6 +33,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef TORRENT_SOCKET_HPP_INCLUDED
|
||||
#define TORRENT_SOCKET_HPP_INCLUDED
|
||||
|
||||
#include "libtorrent/config.hpp"
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
|
||||
// if building as Objective C++, asio's template
|
||||
|
|
|
@ -1251,6 +1251,10 @@ namespace libtorrent
|
|||
// hidden
|
||||
torrent_status();
|
||||
~torrent_status();
|
||||
#if __cplusplus >= 201103L
|
||||
torrent_status(torrent_status const& st) = default;
|
||||
torrent_status& operator=(torrent_status const& st) = default;
|
||||
#endif
|
||||
|
||||
// compres if the torrent status objects come from the same torrent. i.e.
|
||||
// only the torrent_handle field is compared.
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace libtorrent
|
|||
request += "GET ";
|
||||
request += using_proxy ? m_url : m_path;
|
||||
request += "?info_hash=";
|
||||
request += escape_string((char const*)&t->torrent_file().info_hash()[0], 20);
|
||||
request += escape_string(reinterpret_cast<char const*>(&t->torrent_file().info_hash()[0]), 20);
|
||||
request += "&piece=";
|
||||
request += to_string(r.piece).elems;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ int render_lsd_packet(char* dst, int len, int listen_port
|
|||
}
|
||||
} // anonymous namespace
|
||||
|
||||
static error_code ec;
|
||||
static error_code dummy;
|
||||
|
||||
lsd::lsd(io_service& ios, peer_callback_t const& cb
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
|
@ -79,9 +79,9 @@ lsd::lsd(io_service& ios, peer_callback_t const& cb
|
|||
#endif
|
||||
)
|
||||
: m_callback(cb)
|
||||
, m_socket(udp::endpoint(address_v4::from_string("239.192.152.143", ec), 6771))
|
||||
, m_socket(udp::endpoint(address_v4::from_string("239.192.152.143", dummy), 6771))
|
||||
#if TORRENT_USE_IPV6
|
||||
, m_socket6(udp::endpoint(address_v6::from_string("ff15::efc0:988f", ec), 6771))
|
||||
, m_socket6(udp::endpoint(address_v6::from_string("ff15::efc0:988f", dummy), 6771))
|
||||
#endif
|
||||
#ifndef TORRENT_DISABLE_LOGGING
|
||||
, m_log_cb(log)
|
||||
|
|
|
@ -144,31 +144,31 @@ namespace libtorrent
|
|||
#define TORRENT_ASYNC_CALL(x) \
|
||||
boost::shared_ptr<torrent> t = m_torrent.lock(); \
|
||||
if (!t) return; \
|
||||
session_impl& ses = (session_impl&) t->session(); \
|
||||
session_impl& ses = static_cast<session_impl&>(t->session()); \
|
||||
ses.get_io_service().dispatch(boost::bind(&torrent:: x, t))
|
||||
|
||||
#define TORRENT_ASYNC_CALL1(x, a1) \
|
||||
boost::shared_ptr<torrent> t = m_torrent.lock(); \
|
||||
if (!t) return; \
|
||||
session_impl& ses = (session_impl&) t->session(); \
|
||||
session_impl& ses = static_cast<session_impl&>(t->session()); \
|
||||
ses.get_io_service().dispatch(boost::bind(&torrent:: x, t, a1))
|
||||
|
||||
#define TORRENT_ASYNC_CALL2(x, a1, a2) \
|
||||
boost::shared_ptr<torrent> t = m_torrent.lock(); \
|
||||
if (!t) return; \
|
||||
session_impl& ses = (session_impl&) t->session(); \
|
||||
session_impl& ses = static_cast<session_impl&>(t->session()); \
|
||||
ses.get_io_service().dispatch(boost::bind(&torrent:: x, t, a1, a2))
|
||||
|
||||
#define TORRENT_ASYNC_CALL3(x, a1, a2, a3) \
|
||||
boost::shared_ptr<torrent> t = m_torrent.lock(); \
|
||||
if (!t) return; \
|
||||
session_impl& ses = (session_impl&) t->session(); \
|
||||
session_impl& ses = static_cast<session_impl&>(t->session()); \
|
||||
ses.get_io_service().dispatch(boost::bind(&torrent:: x, t, a1, a2, a3))
|
||||
|
||||
#define TORRENT_ASYNC_CALL4(x, a1, a2, a3, a4) \
|
||||
boost::shared_ptr<torrent> t = m_torrent.lock(); \
|
||||
if (!t) return; \
|
||||
session_impl& ses = (session_impl&) t->session(); \
|
||||
session_impl& ses = static_cast<session_impl&>(t->session()); \
|
||||
ses.get_io_service().dispatch(boost::bind(&torrent:: x, t, a1, a2, a3, a4))
|
||||
|
||||
#define TORRENT_SYNC_CALL(x) \
|
||||
|
@ -716,7 +716,7 @@ namespace libtorrent
|
|||
if (t)
|
||||
{
|
||||
bool done = false;
|
||||
session_impl& ses = (session_impl&) t->session();
|
||||
session_impl& ses = static_cast<session_impl&>(t->session());
|
||||
storage_error ec;
|
||||
ses.get_io_service().dispatch(boost::bind(&aux::fun_wrap, boost::ref(done), boost::ref(ses.cond)
|
||||
, boost::ref(ses.mut), boost::function<void(void)>(boost::bind(
|
||||
|
@ -774,7 +774,7 @@ namespace libtorrent
|
|||
|
||||
boost::shared_ptr<torrent> t = m_torrent.lock();
|
||||
if (!t || !t->has_storage()) return;
|
||||
session_impl& ses = (session_impl&) t->session();
|
||||
session_impl& ses = static_cast<session_impl&>(t->session());
|
||||
ses.disk_thread().files().get_status(&status, &t->storage());
|
||||
}
|
||||
|
||||
|
|
|
@ -82,8 +82,8 @@ namespace libtorrent
|
|||
if (e1.port() > e2.port())
|
||||
swap(e1, e2);
|
||||
boost::uint32_t p;
|
||||
reinterpret_cast<boost::uint16_t*>(&p)[0] = htons(e1.port());
|
||||
reinterpret_cast<boost::uint16_t*>(&p)[1] = htons(e2.port());
|
||||
reinterpret_cast<boost::uint16_t*>(&p)[0] = host_to_network(e1.port());
|
||||
reinterpret_cast<boost::uint16_t*>(&p)[1] = host_to_network(e2.port());
|
||||
ret = crc32c_32(p);
|
||||
}
|
||||
#if TORRENT_USE_IPV6
|
||||
|
|
|
@ -82,14 +82,15 @@ void test_transfer(libtorrent::settings_pack::enc_policy policy
|
|||
session_proxy p1;
|
||||
session_proxy p2;
|
||||
|
||||
lt::session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48800, 49000), "0.0.0.0", 0);
|
||||
lt::session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49800, 50000), "0.0.0.0", 0);
|
||||
settings_pack s;
|
||||
|
||||
s.set_int(settings_pack::out_enc_policy, settings_pack::pe_enabled);
|
||||
s.set_int(settings_pack::in_enc_policy, settings_pack::pe_enabled);
|
||||
s.set_int(settings_pack::allowed_enc_level, settings_pack::pe_both);
|
||||
ses2.apply_settings(s);
|
||||
|
||||
s.set_str(settings_pack::listen_interfaces, "0.0.0.0:48800");
|
||||
|
||||
lt::session ses2(s, 0);
|
||||
|
||||
fprintf(stderr, " Session2 \n");
|
||||
display_settings(s);
|
||||
|
@ -98,7 +99,10 @@ void test_transfer(libtorrent::settings_pack::enc_policy policy
|
|||
s.set_int(settings_pack::in_enc_policy, policy);
|
||||
s.set_int(settings_pack::allowed_enc_level, level);
|
||||
s.set_bool(settings_pack::prefer_rc4, pref_rc4);
|
||||
ses1.apply_settings(s);
|
||||
|
||||
s.set_str(settings_pack::listen_interfaces, "0.0.0.0:49800");
|
||||
|
||||
lt::session ses1(s, 0);
|
||||
|
||||
fprintf(stderr, " Session1 \n");
|
||||
display_settings(s);
|
||||
|
|
|
@ -111,6 +111,7 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags)
|
|||
sett.set_bool(settings_pack::enable_upnp, false);
|
||||
sett.set_bool(settings_pack::enable_natpmp, false);
|
||||
sett.set_bool(settings_pack::enable_lsd, false);
|
||||
sett.set_bool(settings_pack::enable_dht, true);
|
||||
|
||||
// since multiple sessions may exist simultaneously (because of the
|
||||
// pipelining of the tests) they actually need to use different ports
|
||||
|
@ -119,7 +120,6 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags)
|
|||
snprintf(iface, sizeof(iface), "127.0.0.1:%d", listen_port);
|
||||
listen_port += (libtorrent::random() % 10) + 1;
|
||||
sett.set_str(settings_pack::listen_interfaces, iface);
|
||||
sett.set_bool(settings_pack::enable_dht, true);
|
||||
|
||||
// if we don't do this, the peer connection test
|
||||
// will be delayed by several seconds, by first
|
||||
|
|
|
@ -57,8 +57,18 @@ TORRENT_TEST(trackers_extension)
|
|||
session_proxy p1;
|
||||
session_proxy p2;
|
||||
|
||||
lt::session ses1(fingerprint("LT", 0, 1, 0, 0), std::make_pair(48130, 49000), "0.0.0.0", 0);
|
||||
lt::session ses2(fingerprint("LT", 0, 1, 0, 0), std::make_pair(49130, 50000), "0.0.0.0", 0);
|
||||
settings_pack s;
|
||||
s.set_bool(settings_pack::enable_upnp, false);
|
||||
s.set_bool(settings_pack::enable_natpmp, false);
|
||||
s.set_bool(settings_pack::enable_lsd, false);
|
||||
s.set_bool(settings_pack::enable_dht, false);
|
||||
s.set_str(settings_pack::listen_interfaces, "0.0.0.0:48130");
|
||||
|
||||
lt::session ses1(s, 0);
|
||||
|
||||
s.set_str(settings_pack::listen_interfaces, "0.0.0.0:49130");
|
||||
lt::session ses2(s, 0);
|
||||
|
||||
ses1.add_extension(create_lt_trackers_plugin);
|
||||
ses2.add_extension(create_lt_trackers_plugin);
|
||||
|
||||
|
@ -71,6 +81,7 @@ TORRENT_TEST(trackers_extension)
|
|||
torrent_handle tor1 = ses1.add_torrent(atp, ec);
|
||||
atp.trackers.push_back("http://test.non-existent.com/announce");
|
||||
torrent_handle tor2 = ses2.add_torrent(atp, ec);
|
||||
|
||||
tor2.connect_peer(tcp::endpoint(address_v4::from_string("127.0.0.1"), ses1.listen_port()));
|
||||
|
||||
// trackers are NOT supposed to be exchanged for torrents that we
|
||||
|
|
Loading…
Reference in New Issue