forked from premiere/premiere-libtorrent
Msvc warnings (#822)
fix msvc warnings in python bindings and simulations
This commit is contained in:
parent
f1585d8317
commit
717ed8bd3b
10
appveyor.yml
10
appveyor.yml
|
@ -81,26 +81,26 @@ build_script:
|
|||
|
||||
# test
|
||||
- cd %ROOT_DIRECTORY%\test
|
||||
- b2.exe --hash -j2 warnings-as-errors=on address-model=%model% win-tests %compiler% variant=%variant% picker-debugging=on link=shared linkflags=%linkflags% include=%include% testing.execute=off
|
||||
- b2.exe --hash warnings-as-errors=on -j2 address-model=%model% win-tests %compiler% variant=%variant% picker-debugging=on link=shared linkflags=%linkflags% include=%include% testing.execute=off
|
||||
|
||||
# python binding
|
||||
- cd %ROOT_DIRECTORY%\bindings\python
|
||||
# we use 64 bit python builds
|
||||
- if defined python ( b2.exe --hash -j2 %compiler% address-model=%model% stage_module install-dependencies=on variant=%variant% picker-debugging=on libtorrent-link=shared linkflags=%linkflags% include=%include% )
|
||||
- if defined python ( b2.exe --hash warnings-as-errors=on -j2 %compiler% address-model=%model% stage_module install-dependencies=on variant=%variant% picker-debugging=on libtorrent-link=shared linkflags=%linkflags% include=%include% )
|
||||
|
||||
# simulations
|
||||
- if defined sim (
|
||||
cd %ROOT_DIRECTORY%\simulation
|
||||
& b2.exe --hash -j2 link=shared crypto=built-in %compiler% address-model=%model% testing.execute=off
|
||||
& b2.exe --hash warnings-as-errors=on -j2 link=shared crypto=built-in %compiler% address-model=%model% testing.execute=off
|
||||
)
|
||||
|
||||
test_script:
|
||||
- cd %ROOT_DIRECTORY%\test
|
||||
# mingw tests crash currently. needs resolving
|
||||
- if not %compiler% == gcc ( b2.exe --hash -j2 address-model=%model% win-tests %compiler% variant=%variant% picker-debugging=on link=shared linkflags=%linkflags% include=%include% )
|
||||
- if not %compiler% == gcc ( b2.exe --hash warnings-as-errors=on -j2 address-model=%model% win-tests %compiler% variant=%variant% picker-debugging=on link=shared linkflags=%linkflags% include=%include% )
|
||||
- cd %ROOT_DIRECTORY%\bindings\python
|
||||
# we use 64 bit python build
|
||||
- if defined python ( c:\Python35-x64\python.exe test.py )
|
||||
- cd %ROOT_DIRECTORY%\simulation
|
||||
- if defined sim ( b2.exe --hash -j2 link=shared crypto=built-in %compiler% address-model=%model% )
|
||||
- if defined sim ( b2.exe --hash warnings-as-errors=on -j2 link=shared crypto=built-in %compiler% address-model=%model% )
|
||||
|
||||
|
|
|
@ -85,11 +85,11 @@ rule libtorrent_linking ( properties * )
|
|||
# (the static build of libpthread is not position independent)
|
||||
if <boost-link>shared in $(properties) || <target-os>linux in $(properties)
|
||||
{
|
||||
result += <library>boost_python/<link>shared ;
|
||||
result += <library>boost_python/<link>shared/<warnings>off ;
|
||||
}
|
||||
else
|
||||
{
|
||||
result += <library>boost_python/<link>static ;
|
||||
result += <library>boost_python/<link>static/<warnings>off ;
|
||||
}
|
||||
|
||||
if <libtorrent-link>shared in $(properties)
|
||||
|
@ -127,7 +127,7 @@ rule my-python-extension ( name : sources * : requirements * : default-build * :
|
|||
my-python-extension libtorrent
|
||||
: # sources
|
||||
src/module.cpp
|
||||
src/big_number.cpp
|
||||
src/sha1_hash.cpp
|
||||
src/converters.cpp
|
||||
src/create_torrent.cpp
|
||||
src/fingerprint.cpp
|
||||
|
@ -152,6 +152,9 @@ my-python-extension libtorrent
|
|||
<toolset>darwin:<cxxflags>-Wno-deprecated-declarations
|
||||
<toolset>darwin:<cxxflags>-Wno-unused-command-line-argument
|
||||
<conditional>@libtorrent_linking
|
||||
: # default-build
|
||||
<warnings>all
|
||||
<warnings-as-errors>on
|
||||
: # usage-requirements
|
||||
<suppress-import-lib>false
|
||||
;
|
||||
|
|
|
@ -7,7 +7,7 @@ EXTRA_DIST = \
|
|||
make_torrent.py \
|
||||
src/alert.cpp \
|
||||
src/bytes.hpp \
|
||||
src/big_number.cpp \
|
||||
src/sha1_hash.cpp \
|
||||
src/converters.cpp \
|
||||
src/create_torrent.cpp \
|
||||
src/datetime.cpp \
|
||||
|
|
|
@ -13,6 +13,12 @@
|
|||
using namespace boost::python;
|
||||
using namespace libtorrent;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
// warning c4996: x: was declared deprecated
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
bytes get_buffer(read_piece_alert const& rpa)
|
||||
{
|
||||
return rpa.buffer ? bytes(rpa.buffer.get(), rpa.size)
|
||||
|
@ -850,3 +856,8 @@ void bind_alert()
|
|||
;
|
||||
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ struct list_to_vector
|
|||
std::vector<T> >*)data)->storage.bytes;
|
||||
|
||||
std::vector<T> p;
|
||||
int const size = PyList_Size(x);
|
||||
int const size = int(PyList_Size(x));
|
||||
p.reserve(size);
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,12 @@
|
|||
using namespace boost::python;
|
||||
using namespace libtorrent;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
// warning c4996: x: was declared deprecated
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
void set_hash(create_torrent& c, int p, bytes const& b)
|
||||
|
@ -151,7 +157,7 @@ void bind_create_torrent()
|
|||
file_entry (file_storage::*at)(int) const = &file_storage::at;
|
||||
#endif
|
||||
|
||||
// TODO: 3 move this to its own file
|
||||
// TODO: 3 move this to its own file
|
||||
class_<file_storage>("file_storage")
|
||||
.def("is_valid", &file_storage::is_valid)
|
||||
.def("add_file", add_file0, (arg("path"), arg("size"), arg("flags") = 0, arg("mtime") = 0, arg("linkpath") = ""))
|
||||
|
@ -236,3 +242,8 @@ void bind_create_torrent()
|
|||
def("set_piece_hashes", set_piece_hashes_callback);
|
||||
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -33,6 +33,12 @@
|
|||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
// warning C4996: X: was declared deprecated
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
using namespace boost::python;
|
||||
using namespace libtorrent;
|
||||
namespace lt = libtorrent;
|
||||
|
@ -102,7 +108,7 @@ namespace
|
|||
void make_settings_pack(lt::settings_pack& p, dict const& sett_dict)
|
||||
{
|
||||
list iterkeys = (list)sett_dict.keys();
|
||||
int const len = boost::python::len(iterkeys);
|
||||
int const len = int(boost::python::len(iterkeys));
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
std::string const key = extract<std::string>(iterkeys[i]);
|
||||
|
@ -239,7 +245,7 @@ namespace
|
|||
if (params.has_key("trackers"))
|
||||
{
|
||||
list l = extract<list>(params["trackers"]);
|
||||
int n = boost::python::len(l);
|
||||
int const n = int(boost::python::len(l));
|
||||
for(int i = 0; i < n; i++)
|
||||
p.trackers.push_back(extract<std::string>(l[i]));
|
||||
}
|
||||
|
@ -247,7 +253,7 @@ namespace
|
|||
if (params.has_key("dht_nodes"))
|
||||
{
|
||||
list l = extract<list>(params["dht_nodes"]);
|
||||
int n = boost::python::len(l);
|
||||
int const n = int(boost::python::len(l));
|
||||
for(int i = 0; i < n; i++)
|
||||
p.dht_nodes.push_back(extract<std::pair<std::string, int> >(l[i]));
|
||||
}
|
||||
|
@ -265,7 +271,7 @@ namespace
|
|||
if (params.has_key("file_priorities"))
|
||||
{
|
||||
list l = extract<list>(params["file_priorities"]);
|
||||
int n = boost::python::len(l);
|
||||
int const n = int(boost::python::len(l));
|
||||
for(int i = 0; i < n; i++)
|
||||
p.file_priorities.push_back(extract<std::uint8_t>(l[i]));
|
||||
p.file_priorities.clear();
|
||||
|
@ -449,8 +455,8 @@ namespace
|
|||
std::vector<char> buf;
|
||||
bencode(std::back_inserter(buf), e);
|
||||
++seq;
|
||||
sign_mutable_item(std::pair<char const*, int>(&buf[0], buf.size())
|
||||
, std::pair<char const*, int>(&salt[0], salt.size())
|
||||
sign_mutable_item(std::pair<char const*, int>(&buf[0], int(buf.size()))
|
||||
, std::pair<char const*, int>(&salt[0], int(salt.size()))
|
||||
, seq, public_key.c_str(), private_key.c_str(), sig.data());
|
||||
}
|
||||
|
||||
|
@ -470,7 +476,7 @@ namespace
|
|||
add_torrent_params read_resume_data_wrapper(bytes const& b)
|
||||
{
|
||||
error_code ec;
|
||||
add_torrent_params p = read_resume_data(&b.arr[0], b.arr.size(), ec);
|
||||
add_torrent_params p = read_resume_data(&b.arr[0], int(b.arr.size()), ec);
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
if (ec) throw system_error(ec);
|
||||
#endif
|
||||
|
@ -875,3 +881,7 @@ void bind_session()
|
|||
scope().attr("create_smart_ban_plugin") = "smart_ban";
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
long get_hash(boost::python::object o)
|
||||
{
|
||||
using namespace boost::python;
|
||||
return PyObject_Hash(str(o).ptr());
|
||||
return long(PyObject_Hash(str(o).ptr()));
|
||||
}
|
||||
|
||||
using namespace libtorrent;
|
|
@ -18,6 +18,12 @@
|
|||
using namespace boost::python;
|
||||
using namespace libtorrent;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
// warning c4996: x: was declared deprecated
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
@ -285,7 +291,7 @@ list get_download_queue(torrent_handle& handle)
|
|||
block_info["block_size"] = i->blocks[k].block_size;
|
||||
block_info["peer"] = boost::python::make_tuple(
|
||||
i->blocks[k].peer().address().to_string()
|
||||
, i->blocks[k].peer().port());
|
||||
, i->blocks[k].peer().port());
|
||||
block_list.append(block_info);
|
||||
}
|
||||
partial_piece["blocks"] = block_list;
|
||||
|
@ -298,7 +304,7 @@ list get_download_queue(torrent_handle& handle)
|
|||
|
||||
void set_metadata(torrent_handle& handle, std::string const& buf)
|
||||
{
|
||||
handle.set_metadata(buf.c_str(), buf.size());
|
||||
handle.set_metadata(buf.c_str(), int(buf.size()));
|
||||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
|
@ -489,3 +495,8 @@ void bind_torrent_handle()
|
|||
.value("dont_replace", dont_replace)
|
||||
;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -16,6 +16,12 @@
|
|||
#include "libtorrent/announce_entry.hpp"
|
||||
#include "bytes.hpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
// warning C4996: X: was declared deprecated
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
using namespace boost::python;
|
||||
using namespace libtorrent;
|
||||
|
||||
|
@ -84,7 +90,7 @@ namespace
|
|||
void set_merkle_tree(torrent_info& ti, list hashes)
|
||||
{
|
||||
std::vector<sha1_hash> h;
|
||||
for (int i = 0, e = len(hashes); i < e; ++i)
|
||||
for (int i = 0, e = int(len(hashes)); i < e; ++i)
|
||||
h.push_back(sha1_hash(bytes(extract<bytes>(hashes[i])).arr));
|
||||
|
||||
ti.set_merkle_tree(h);
|
||||
|
@ -314,3 +320,7 @@ void bind_torrent_info()
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -10,6 +10,12 @@
|
|||
using namespace boost::python;
|
||||
using namespace libtorrent;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
// warning C4996: X: was declared deprecated
|
||||
#pragma warning( disable : 4996 )
|
||||
#endif
|
||||
|
||||
struct bytes_to_python
|
||||
{
|
||||
static PyObject* convert(bytes const& p)
|
||||
|
@ -92,3 +98,7 @@ void bind_utility()
|
|||
def("bencode", &bencode_);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ use-project /libtorrent_test : ../test ;
|
|||
|
||||
use-project /libsimulator : libsimulator ;
|
||||
|
||||
# TODO: create another library with the libtorrent simulator utilities
|
||||
project
|
||||
: requirements
|
||||
<simulator>on
|
||||
|
|
|
@ -113,7 +113,7 @@ struct fake_peer
|
|||
|
||||
void send_bitfield(std::vector<bool> const& pieces)
|
||||
{
|
||||
int const bytes = (pieces.size() + 7) / 8;
|
||||
int const bytes = (int(pieces.size()) + 7) / 8;
|
||||
m_send_buffer.resize(m_send_buffer.size() + 5 + bytes);
|
||||
char* ptr = m_send_buffer.data() + m_send_buffer.size() - 5 - bytes;
|
||||
|
||||
|
@ -157,7 +157,8 @@ private:
|
|||
memcpy(&m_out_buffer[28], ih.data(), 20);
|
||||
|
||||
asio::async_write(m_socket, asio::const_buffers_1(&m_out_buffer[0]
|
||||
, len), [this, ep](boost::system::error_code const& ec, size_t bytes_transferred)
|
||||
, len), [this, ep](boost::system::error_code const& ec
|
||||
, size_t /* bytes_transferred */)
|
||||
{
|
||||
std::printf("fake_peer::write_handshake(%s) -> (%d) %s\n"
|
||||
, lt::print_endpoint(ep).c_str(), ec.value()
|
||||
|
@ -176,7 +177,7 @@ private:
|
|||
});
|
||||
}
|
||||
|
||||
void read_handshake(lt::error_code const& ec, size_t bytes_transferred)
|
||||
void read_handshake(lt::error_code const& ec, size_t /* bytes_transferred */)
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
|
||||
|
@ -213,7 +214,7 @@ private:
|
|||
, std::bind(&fake_peer::on_read, this, _1, _2));
|
||||
}
|
||||
|
||||
void on_read(lt::error_code const& ec, size_t bytes_transferred)
|
||||
void on_read(lt::error_code const& ec, size_t /* bytes_transferred */)
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
|
||||
|
@ -233,7 +234,7 @@ private:
|
|||
}
|
||||
|
||||
void write_send_buffer(boost::system::error_code const& ec
|
||||
, size_t bytes_transferred)
|
||||
, size_t /* bytes_transferred */)
|
||||
{
|
||||
using namespace std::placeholders;
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit d8b5afdcc4861cb2131618a6cc1cac8d85e2011d
|
||||
Subproject commit 0c796e3e0dea7ca05eef3ded2cf3806ef19a1413
|
|
@ -36,12 +36,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/aux_/proxy_settings.hpp"
|
||||
|
||||
inline libtorrent::aux::proxy_settings make_proxy_settings(
|
||||
libtorrent::settings_pack::proxy_type_t proxy_type)
|
||||
libtorrent::settings_pack::proxy_type_t const proxy_type)
|
||||
{
|
||||
using namespace libtorrent;
|
||||
|
||||
aux::proxy_settings ps;
|
||||
ps.type = proxy_type;
|
||||
ps.type = boost::uint8_t(proxy_type);
|
||||
ps.proxy_hostnames = false;
|
||||
// this IP and ports are specific to test_http_connection.cpp
|
||||
if (proxy_type != settings_pack::none)
|
||||
|
|
|
@ -59,12 +59,12 @@ namespace {
|
|||
lt::time_point start_time;
|
||||
|
||||
// this is the IP address assigned to node 'idx'
|
||||
asio::ip::address addr_from_int(int idx)
|
||||
asio::ip::address addr_from_int(int /* idx */)
|
||||
{
|
||||
return asio::ip::address_v4(lt::random());
|
||||
}
|
||||
|
||||
asio::ip::address addr6_from_int(int idx)
|
||||
asio::ip::address addr6_from_int(int /* idx */)
|
||||
{
|
||||
asio::ip::address_v6::bytes_type bytes;
|
||||
for (uint8_t& b : bytes) b = uint8_t(lt::random());
|
||||
|
@ -82,7 +82,7 @@ namespace {
|
|||
struct dht_node final : lt::dht::udp_socket_interface
|
||||
{
|
||||
dht_node(sim::simulation& sim, lt::dht_settings const& sett, lt::counters& cnt
|
||||
, int idx, std::uint32_t flags)
|
||||
, int const idx, std::uint32_t const flags)
|
||||
: m_io_service(sim, (flags & dht_network::bind_ipv6) ? addr6_from_int(idx) : addr_from_int(idx))
|
||||
, m_dht_storage(lt::dht::dht_default_storage_constructor(sett))
|
||||
#if LIBSIMULATOR_USE_MOVE
|
||||
|
@ -96,8 +96,8 @@ struct dht_node final : lt::dht::udp_socket_interface
|
|||
, this, sett, id_from_addr(m_io_service.get_ips().front())
|
||||
, nullptr, cnt, std::map<std::string, lt::dht::node*>(), *m_dht_storage))
|
||||
#endif
|
||||
, m_add_dead_nodes(flags & dht_network::add_dead_nodes)
|
||||
, m_ipv6(flags & dht_network::bind_ipv6)
|
||||
, m_add_dead_nodes((flags & dht_network::add_dead_nodes) != 0)
|
||||
, m_ipv6((flags & dht_network::bind_ipv6) != 0)
|
||||
{
|
||||
m_dht_storage->update_node_ids({id_from_addr(m_io_service.get_ips().front())});
|
||||
error_code ec;
|
||||
|
|
|
@ -199,7 +199,7 @@ void setup_swarm(int num_nodes
|
|||
, std::function<void(lt::settings_pack&)> new_session
|
||||
, std::function<void(lt::add_torrent_params&)> add_torrent
|
||||
, std::function<void(lt::alert const*, lt::session&)> on_alert
|
||||
, std::function<int(int, lt::session&)> terminate)
|
||||
, std::function<bool(int, lt::session&)> terminate)
|
||||
{
|
||||
dsl_config network_cfg;
|
||||
sim::simulation sim{network_cfg};
|
||||
|
@ -214,7 +214,7 @@ void setup_swarm(int num_nodes
|
|||
, std::function<void(lt::settings_pack&)> new_session
|
||||
, std::function<void(lt::add_torrent_params&)> add_torrent
|
||||
, std::function<void(lt::alert const*, lt::session&)> on_alert
|
||||
, std::function<int(int, lt::session&)> terminate)
|
||||
, std::function<bool(int, lt::session&)> terminate)
|
||||
{
|
||||
lt::settings_pack pack = settings();
|
||||
|
||||
|
@ -234,7 +234,7 @@ void setup_swarm(int num_nodes
|
|||
, std::function<void(lt::settings_pack&)> new_session
|
||||
, std::function<void(lt::add_torrent_params&)> add_torrent
|
||||
, std::function<void(lt::alert const*, lt::session&)> on_alert
|
||||
, std::function<int(int, lt::session&)> terminate)
|
||||
, std::function<bool(int, lt::session&)> terminate)
|
||||
{
|
||||
setup_swarm(num_nodes, type, sim
|
||||
, default_settings
|
||||
|
@ -255,7 +255,7 @@ void setup_swarm(int num_nodes
|
|||
, std::function<void(lt::settings_pack&)> new_session
|
||||
, std::function<void(lt::add_torrent_params&)> add_torrent
|
||||
, std::function<void(lt::alert const*, lt::session&)> on_alert
|
||||
, std::function<int(int, lt::session&)> terminate)
|
||||
, std::function<bool(int, lt::session&)> terminate)
|
||||
{
|
||||
asio::io_service ios(sim);
|
||||
lt::time_point start_time(lt::clock_type::now());
|
||||
|
@ -351,7 +351,8 @@ void setup_swarm(int num_nodes
|
|||
|
||||
// only print alerts from the session under test
|
||||
lt::time_duration d = a->timestamp() - start_time;
|
||||
std::uint32_t const millis = lt::duration_cast<lt::milliseconds>(d).count();
|
||||
std::uint32_t const millis = std::uint32_t(
|
||||
lt::duration_cast<lt::milliseconds>(d).count());
|
||||
|
||||
if (should_print(a))
|
||||
{
|
||||
|
|
|
@ -56,7 +56,7 @@ void setup_swarm(int num_nodes
|
|||
, std::function<void(lt::settings_pack&)> new_session
|
||||
, std::function<void(lt::add_torrent_params&)> add_torrent
|
||||
, std::function<void(lt::alert const*, lt::session&)> on_alert
|
||||
, std::function<int(int, lt::session&)> terminate);
|
||||
, std::function<bool(int, lt::session&)> terminate);
|
||||
|
||||
void setup_swarm(int num_nodes
|
||||
, swarm_test type
|
||||
|
@ -64,7 +64,7 @@ void setup_swarm(int num_nodes
|
|||
, std::function<void(lt::settings_pack&)> new_session
|
||||
, std::function<void(lt::add_torrent_params&)> add_torrent
|
||||
, std::function<void(lt::alert const*, lt::session&)> on_alert
|
||||
, std::function<int(int, lt::session&)> terminate);
|
||||
, std::function<bool(int, lt::session&)> terminate);
|
||||
|
||||
void setup_swarm(int num_nodes
|
||||
, swarm_test type
|
||||
|
@ -74,7 +74,7 @@ void setup_swarm(int num_nodes
|
|||
, std::function<void(lt::settings_pack&)> new_session
|
||||
, std::function<void(lt::add_torrent_params&)> add_torrent
|
||||
, std::function<void(lt::alert const*, lt::session&)> on_alert
|
||||
, std::function<int(int, lt::session&)> terminate);
|
||||
, std::function<bool(int, lt::session&)> terminate);
|
||||
|
||||
void setup_swarm(int num_nodes
|
||||
, swarm_test type
|
||||
|
@ -85,7 +85,7 @@ void setup_swarm(int num_nodes
|
|||
, std::function<void(lt::settings_pack&)> new_session
|
||||
, std::function<void(lt::add_torrent_params&)> add_torrent
|
||||
, std::function<void(lt::alert const*, lt::session&)> on_alert
|
||||
, std::function<int(int, lt::session&)> terminate);
|
||||
, std::function<bool(int, lt::session&)> terminate);
|
||||
|
||||
bool has_metadata(lt::session& ses);
|
||||
bool is_seed(lt::session& ses);
|
||||
|
|
|
@ -590,7 +590,7 @@ TORRENT_TEST(paused_checking)
|
|||
TORRENT_TEST(stop_when_ready)
|
||||
{
|
||||
run_test(
|
||||
[](settings_pack& sett) {},
|
||||
[](settings_pack&) {},
|
||||
|
||||
[](lt::session& ses) {
|
||||
// add torrents
|
||||
|
|
|
@ -64,7 +64,7 @@ void run_test(Setup const& setup, Test const& test)
|
|||
|
||||
print_alerts(*ses);
|
||||
|
||||
sim::timer t(sim, lt::seconds(6), [&](boost::system::error_code const& ec)
|
||||
sim::timer t(sim, lt::seconds(6), [&](boost::system::error_code const&)
|
||||
{
|
||||
test(*ses);
|
||||
|
||||
|
|
|
@ -108,16 +108,15 @@ TORRENT_TEST(dht_bootstrap)
|
|||
|
||||
setup_swarm(1, swarm_test::download, sim
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {
|
||||
}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [&](lt::alert const* a, lt::session& ses)
|
||||
, [&](lt::alert const* a, lt::session&)
|
||||
{
|
||||
if (lt::dht_stats_alert const* p = lt::alert_cast<lt::dht_stats_alert>(a))
|
||||
{
|
||||
routing_table_depth = p->routing_table.size();
|
||||
routing_table_depth = int(p->routing_table.size());
|
||||
int c = 0;
|
||||
for (auto const& b : p->routing_table)
|
||||
{
|
||||
|
@ -173,12 +172,12 @@ TORRENT_TEST(dht_dual_stack_get_peers)
|
|||
|
||||
setup_swarm(1, swarm_test::download, sim
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {
|
||||
, [](lt::settings_pack&) {
|
||||
}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [&](lt::alert const* a, lt::session& ses)
|
||||
, [&](lt::alert const* a, lt::session&)
|
||||
{
|
||||
if (lt::dht_get_peers_reply_alert const* p = lt::alert_cast<lt::dht_get_peers_reply_alert>(a))
|
||||
{
|
||||
|
@ -234,12 +233,12 @@ TORRENT_TEST(dht_dual_stack_immutable_item)
|
|||
|
||||
setup_swarm(1, swarm_test::download, sim
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {
|
||||
, [](lt::settings_pack&) {
|
||||
}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [&](lt::alert const* a, lt::session& ses)
|
||||
, [&](lt::alert const* a, lt::session&)
|
||||
{
|
||||
if (lt::dht_immutable_item_alert const* p = lt::alert_cast<lt::dht_immutable_item_alert>(a))
|
||||
{
|
||||
|
@ -292,12 +291,12 @@ TORRENT_TEST(dht_dual_stack_mutable_item)
|
|||
|
||||
setup_swarm(1, swarm_test::download, sim
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {
|
||||
, [](lt::settings_pack&) {
|
||||
}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [&](lt::alert const* a, lt::session& ses)
|
||||
, [&](lt::alert const* a, lt::session&)
|
||||
{
|
||||
if (lt::dht_mutable_item_alert const* p = lt::alert_cast<lt::dht_mutable_item_alert>(a))
|
||||
{
|
||||
|
@ -327,7 +326,8 @@ TORRENT_TEST(dht_dual_stack_mutable_item)
|
|||
std::vector<char> v;
|
||||
lt::bencode(std::back_inserter(v), item);
|
||||
lt::dht::sign_mutable_item(
|
||||
std::make_pair(v.data(), v.size()), std::make_pair(salt.data(), salt.size())
|
||||
std::make_pair(v.data(), int(v.size()))
|
||||
, std::make_pair(salt.data(), int(salt.size()))
|
||||
, seq, pk.data(), sk.data(), sig.data());
|
||||
put_count++;
|
||||
});
|
||||
|
|
|
@ -54,8 +54,8 @@ using namespace std::placeholders;
|
|||
|
||||
struct obs : dht::dht_observer
|
||||
{
|
||||
virtual void set_external_address(address const& addr
|
||||
, address const& source) override
|
||||
virtual void set_external_address(address const& /* addr */
|
||||
, address const& /* source */) override
|
||||
{}
|
||||
virtual address external_address(udp proto) override
|
||||
{
|
||||
|
@ -64,10 +64,11 @@ struct obs : dht::dht_observer
|
|||
else
|
||||
return address_v6();
|
||||
}
|
||||
virtual void get_peers(sha1_hash const& ih) override {}
|
||||
virtual void outgoing_get_peers(sha1_hash const& target
|
||||
, sha1_hash const& sent_target, udp::endpoint const& ep) override {}
|
||||
virtual void announce(sha1_hash const& ih, address const& addr, int port) override {}
|
||||
virtual void get_peers(sha1_hash const&) override {}
|
||||
virtual void outgoing_get_peers(sha1_hash const& /* target */
|
||||
, sha1_hash const& /* sent_target */, udp::endpoint const& /* ep */) override {}
|
||||
virtual void announce(sha1_hash const& /* ih */
|
||||
, address const& /* addr */, int /* port */) override {}
|
||||
virtual void log(dht_logger::module_t l, char const* fmt, ...) override
|
||||
{
|
||||
va_list v;
|
||||
|
@ -76,10 +77,12 @@ struct obs : dht::dht_observer
|
|||
va_end(v);
|
||||
puts("\n");
|
||||
}
|
||||
virtual void log_packet(message_direction_t dir, char const* pkt, int len
|
||||
, udp::endpoint node) override {}
|
||||
virtual bool on_dht_request(char const* query, int query_len
|
||||
, dht::msg const& request, entry& response) override { return false; }
|
||||
virtual void log_packet(message_direction_t /* dir */
|
||||
, char const* /* pkt */, int /* len */
|
||||
, udp::endpoint /* node */) override {}
|
||||
virtual bool on_dht_request(char const* /* query */, int /* query_len */
|
||||
, dht::msg const& /* request */, entry& /* response */) override
|
||||
{ return false; }
|
||||
};
|
||||
|
||||
#endif // #if !defined TORRENT_DISABLE_DHT
|
||||
|
@ -113,13 +116,13 @@ TORRENT_TEST(dht_rate_limit)
|
|||
|
||||
bool stop = false;
|
||||
std::function<void(error_code const&, size_t)> on_read
|
||||
= [&](error_code const& ec, size_t bytes)
|
||||
= [&](error_code const& ec, size_t const /* bytes */)
|
||||
{
|
||||
if (ec) return;
|
||||
udp_socket::packet p;
|
||||
error_code err;
|
||||
int const num = sock.read(lt::aux::array_view<udp_socket::packet>(&p, 1), err);
|
||||
if (num) dht->incoming_packet(p.from, p.data.data(), p.data.size());
|
||||
int const num = int(sock.read(lt::aux::array_view<udp_socket::packet>(&p, 1), err));
|
||||
if (num) dht->incoming_packet(p.from, p.data.data(), int(p.data.size()));
|
||||
if (stop || err) return;
|
||||
sock.async_read(on_read);
|
||||
};
|
||||
|
@ -133,13 +136,13 @@ TORRENT_TEST(dht_rate_limit)
|
|||
sender_sock.bind(udp::endpoint(address_v4(), 4444));
|
||||
sender_sock.io_control(udp::socket::non_blocking_io(true));
|
||||
asio::high_resolution_timer timer(sender_ios);
|
||||
std::function<void(error_code const&)> sender_tick = [&](error_code const& ec)
|
||||
std::function<void(error_code const&)> sender_tick = [&](error_code const&)
|
||||
{
|
||||
if (num_packets_sent == num_packets)
|
||||
{
|
||||
// we're done. shut down (a second from now, to let the dust settle)
|
||||
timer.expires_from_now(chrono::seconds(1));
|
||||
timer.async_wait([&](error_code const& ec)
|
||||
timer.async_wait([&](error_code const&)
|
||||
{
|
||||
dht->stop();
|
||||
stop = true;
|
||||
|
@ -165,11 +168,11 @@ TORRENT_TEST(dht_rate_limit)
|
|||
int num_packets_received = 0;
|
||||
char buffer[1500];
|
||||
std::function<void(error_code const&, std::size_t)> on_receive
|
||||
= [&](error_code const& ec, std::size_t bytes)
|
||||
= [&](error_code const& ec, std::size_t const bytes)
|
||||
{
|
||||
if (ec) return;
|
||||
|
||||
num_bytes_received += bytes;
|
||||
num_bytes_received += int(bytes);
|
||||
++num_packets_received;
|
||||
|
||||
sender_sock.async_receive_from(asio::mutable_buffers_1(buffer, sizeof(buffer))
|
||||
|
|
|
@ -90,7 +90,7 @@ namespace
|
|||
|
||||
void timer_tick(dht_storage_interface* s
|
||||
, dht_storage_counters const& c
|
||||
, boost::system::error_code const& ec)
|
||||
, boost::system::error_code const&)
|
||||
{
|
||||
libtorrent::aux::update_time_now();
|
||||
s->tick();
|
||||
|
|
|
@ -77,7 +77,7 @@ void run_fake_peer_test(
|
|||
});
|
||||
|
||||
sim::timer t(sim, lt::seconds(1)
|
||||
, [&](boost::system::error_code const& ec)
|
||||
, [&](boost::system::error_code const&)
|
||||
{
|
||||
ses->set_alert_notify([]{});
|
||||
// shut down
|
||||
|
@ -109,7 +109,7 @@ TORRENT_TEST(allow_fast)
|
|||
run_fake_peer_test(params, [] (lt::settings_pack& pack) {
|
||||
pack.set_int(lt::settings_pack::allowed_fast_set_size, 13);
|
||||
}
|
||||
, [&] (lt::session& ses, lt::alert const* a, fake_peer& p1)
|
||||
, [&] (lt::session&, lt::alert const* a, fake_peer& p1)
|
||||
{
|
||||
if (auto at = lt::alert_cast<lt::add_torrent_alert>(a))
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ TORRENT_TEST(allow_fast_stress)
|
|||
run_fake_peer_test(params, [&] (lt::settings_pack& pack) {
|
||||
pack.set_int(lt::settings_pack::allowed_fast_set_size, num_pieces - 1);
|
||||
}
|
||||
, [&] (lt::session& ses, lt::alert const* a, fake_peer& p1)
|
||||
, [&] (lt::session&, lt::alert const* a, fake_peer& p1)
|
||||
{
|
||||
if (auto at = lt::alert_cast<lt::add_torrent_alert>(a))
|
||||
{
|
||||
|
|
|
@ -46,7 +46,9 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "make_proxy_settings.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||
#include <boost/crc.hpp>
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace sim;
|
||||
|
@ -125,7 +127,7 @@ boost::shared_ptr<http_connection> test_request(io_service& ios
|
|||
auto h = boost::make_shared<http_connection>(ios
|
||||
, res
|
||||
, [=](error_code const& ec, http_parser const& parser
|
||||
, char const* data, const int size, http_connection& c)
|
||||
, char const* data, const int size, http_connection&)
|
||||
{
|
||||
std::printf("RESPONSE: %s\n", url.c_str());
|
||||
++*handler_called;
|
||||
|
@ -359,7 +361,7 @@ void run_test(lt::aux::proxy_settings ps, std::string url, int expect_size, int
|
|||
|
||||
http.register_handler("/redirect"
|
||||
, [&data_buffer,&counters](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
++counters[redirect_req];
|
||||
TEST_EQUAL(method, "GET");
|
||||
|
@ -370,7 +372,7 @@ void run_test(lt::aux::proxy_settings ps, std::string url, int expect_size, int
|
|||
|
||||
http.register_handler("/relative/redirect"
|
||||
, [&data_buffer,&counters](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
++counters[rel_redirect_req];
|
||||
TEST_EQUAL(method, "GET");
|
||||
|
@ -381,7 +383,7 @@ void run_test(lt::aux::proxy_settings ps, std::string url, int expect_size, int
|
|||
|
||||
http.register_handler("/infinite/redirect"
|
||||
, [&data_buffer,&counters](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
++counters[inf_redirect_req];
|
||||
TEST_EQUAL(method, "GET");
|
||||
|
@ -462,7 +464,8 @@ void test_proxy_failure(lt::settings_pack::proxy_type_t proxy_type)
|
|||
, std::map<std::string, std::string>& headers)
|
||||
{
|
||||
print_http_header(headers);
|
||||
TEST_CHECK(false && "we're not supposed to get here!");
|
||||
// we're not supposed to get here
|
||||
TEST_CHECK(false);
|
||||
return sim::send_response(200, "OK", 1337).append(data_buffer, 1337);
|
||||
});
|
||||
|
||||
|
|
|
@ -84,7 +84,8 @@ void run_test(Setup const& setup
|
|||
on_alert(ses, a);
|
||||
});
|
||||
|
||||
sim::timer t(sim, lt::seconds(60), [&](boost::system::error_code const& ec)
|
||||
sim::timer t(sim, lt::seconds(60)
|
||||
, [&](boost::system::error_code const&)
|
||||
{
|
||||
test(*ses, test_peers);
|
||||
|
||||
|
@ -126,7 +127,7 @@ TORRENT_TEST(apply_ip_filter)
|
|||
ses.async_add_torrent(params);
|
||||
},
|
||||
|
||||
[&](lt::session& ses, lt::alert const* a)
|
||||
[&](lt::session&, lt::alert const* a)
|
||||
{
|
||||
if (auto at = lt::alert_cast<lt::add_torrent_alert>(a))
|
||||
{
|
||||
|
@ -135,7 +136,7 @@ TORRENT_TEST(apply_ip_filter)
|
|||
}
|
||||
},
|
||||
|
||||
[](lt::session& ses, std::array<fake_peer*, 5>& test_peers)
|
||||
[](lt::session&, std::array<fake_peer*, 5>& test_peers)
|
||||
{
|
||||
check_accepted(test_peers, {{false, false, false, true, true}} );
|
||||
}
|
||||
|
@ -168,7 +169,7 @@ TORRENT_TEST(update_ip_filter)
|
|||
}
|
||||
},
|
||||
|
||||
[](lt::session& ses, std::array<fake_peer*, 5>& test_peers)
|
||||
[](lt::session&, std::array<fake_peer*, 5>& test_peers)
|
||||
{
|
||||
check_accepted(test_peers, {{false, false, false, true, true}} );
|
||||
}
|
||||
|
@ -191,7 +192,7 @@ TORRENT_TEST(apply_ip_filter_to_torrent)
|
|||
ses.async_add_torrent(params);
|
||||
},
|
||||
|
||||
[&](lt::session& ses, lt::alert const* a)
|
||||
[&](lt::session&, lt::alert const* a)
|
||||
{
|
||||
if (auto at = lt::alert_cast<lt::add_torrent_alert>(a))
|
||||
{
|
||||
|
@ -200,7 +201,7 @@ TORRENT_TEST(apply_ip_filter_to_torrent)
|
|||
}
|
||||
},
|
||||
|
||||
[](lt::session& ses, std::array<fake_peer*, 5>& test_peers)
|
||||
[](lt::session&, std::array<fake_peer*, 5>& test_peers)
|
||||
{
|
||||
// since the IP filter didn't apply to this torrent, it should have hit
|
||||
// all peers
|
||||
|
@ -230,8 +231,8 @@ TORRENT_TEST(ip_filter_trackers)
|
|||
ses.async_add_torrent(params);
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::alert const* a) {},
|
||||
[](lt::session& ses, std::array<fake_peer*, 5>& test_peers)
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](lt::session&, std::array<fake_peer*, 5>& test_peers)
|
||||
{
|
||||
check_accepted(test_peers, {{false, false, false, true, true}} );
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ void run_metadata_test(int flags)
|
|||
|
||||
setup_swarm(2, (flags & reverse) ? swarm_test::upload : swarm_test::download
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {
|
||||
// we want to add the torrent via magnet link
|
||||
|
|
|
@ -93,7 +93,7 @@ TORRENT_TEST(optimistic_unchoke)
|
|||
|
||||
print_alerts(*ses);
|
||||
|
||||
sim::timer t(sim, lt::seconds(0), [&](boost::system::error_code const& ec)
|
||||
sim::timer t(sim, lt::seconds(0), [&](boost::system::error_code const&)
|
||||
{
|
||||
for (int i = 0; i < num_nodes; ++i)
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ TORRENT_TEST(optimistic_unchoke)
|
|||
io_service.push_back(std::make_shared<sim::asio::io_service>(
|
||||
std::ref(sim), addr(ep)));
|
||||
peers.push_back(std::make_shared<peer_conn>(std::ref(*io_service.back())
|
||||
, [&,i](int msg, char const* bug, int len)
|
||||
, [&,i](int msg, char const* /* buf */, int /* len */)
|
||||
{
|
||||
choke_state& cs = peer_choke_state[i];
|
||||
if (msg == 0)
|
||||
|
@ -132,7 +132,8 @@ TORRENT_TEST(optimistic_unchoke)
|
|||
char const* msg_str[] = {"choke", "unchoke"};
|
||||
|
||||
lt::time_duration d = lt::clock_type::now() - start_time;
|
||||
std::uint32_t millis = lt::duration_cast<lt::milliseconds>(d).count();
|
||||
std::uint32_t const millis = boost::uint32_t(
|
||||
lt::duration_cast<lt::milliseconds>(d).count());
|
||||
printf("\x1b[35m%4d.%03d: [%d] %s (%d ms)\x1b[0m\n"
|
||||
, millis / 1000, millis % 1000, i, msg_str[msg]
|
||||
, int(lt::duration_cast<lt::milliseconds>(cs.unchoke_duration).count()));
|
||||
|
@ -143,7 +144,7 @@ TORRENT_TEST(optimistic_unchoke)
|
|||
}
|
||||
});
|
||||
|
||||
sim::timer t2(sim, test_duration, [&](boost::system::error_code const& ec)
|
||||
sim::timer t2(sim, test_duration, [&](boost::system::error_code const&)
|
||||
{
|
||||
for (auto& p : peers)
|
||||
{
|
||||
|
|
|
@ -95,7 +95,7 @@ void run_test(Setup const& setup, Torrent const& torrent
|
|||
});
|
||||
|
||||
sim::timer t1(sim, lt::seconds(5)
|
||||
, [&](boost::system::error_code const& ec)
|
||||
, [&](boost::system::error_code const&)
|
||||
{
|
||||
test(*ses, h, test_peers);
|
||||
});
|
||||
|
@ -103,7 +103,7 @@ void run_test(Setup const& setup, Torrent const& torrent
|
|||
// set up a timer to fire later, to verify everything we expected to happen
|
||||
// happened
|
||||
sim::timer t2(sim, lt::seconds(10)
|
||||
, [&](boost::system::error_code const& ec)
|
||||
, [&](boost::system::error_code const&)
|
||||
{
|
||||
check(*ses, h, test_peers);
|
||||
|
||||
|
@ -119,19 +119,19 @@ void run_test(Setup const& setup, Torrent const& torrent
|
|||
TORRENT_TEST(torrent_paused_disconnect)
|
||||
{
|
||||
run_test(
|
||||
[](lt::session& ses) {},
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&) {},
|
||||
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
add_fake_peers(h, 3);
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
check_accepted(test_peers, {{true, true, true}});
|
||||
check_connected(test_peers, {{true, true, true}});
|
||||
check_disconnected(test_peers, {{false, false, false}});
|
||||
h.pause();
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
check_disconnected(test_peers, {{true, true, true}});
|
||||
TEST_EQUAL(h.status().paused, true);
|
||||
});
|
||||
|
@ -141,8 +141,8 @@ TORRENT_TEST(torrent_paused_disconnect)
|
|||
TORRENT_TEST(session_paused_disconnect)
|
||||
{
|
||||
run_test(
|
||||
[](lt::session& ses) {},
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&) {},
|
||||
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
add_fake_peers(h, 3);
|
||||
},
|
||||
|
||||
|
@ -153,7 +153,7 @@ TORRENT_TEST(session_paused_disconnect)
|
|||
ses.pause();
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
check_disconnected(test_peers, {{true, true, true}});
|
||||
|
||||
// the torrent isn't paused, the session is
|
||||
|
@ -167,15 +167,15 @@ TORRENT_TEST(paused_session_add_torrent)
|
|||
{
|
||||
run_test(
|
||||
[](lt::session& ses) { ses.pause(); },
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
add_fake_peers(h, 3);
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&, lt::torrent_handle, std::array<fake_peer*, 3>& test_peers) {
|
||||
check_accepted(test_peers, {{false, false, false}});
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
// the torrent isn't paused, the session is
|
||||
TEST_EQUAL(h.status().paused, false);
|
||||
});
|
||||
|
@ -185,18 +185,18 @@ TORRENT_TEST(paused_session_add_torrent)
|
|||
TORRENT_TEST(paused_torrent_add_peers)
|
||||
{
|
||||
run_test(
|
||||
[](lt::session& ses) {},
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&) {},
|
||||
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
h.pause();
|
||||
|
||||
add_fake_peers(h, 3);
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&, lt::torrent_handle, std::array<fake_peer*, 3>& test_peers) {
|
||||
check_accepted(test_peers, {{false, false, false}});
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
TEST_EQUAL(h.status().paused, true);
|
||||
});
|
||||
}
|
||||
|
@ -205,15 +205,15 @@ TORRENT_TEST(paused_torrent_add_peers)
|
|||
TORRENT_TEST(torrent_paused_alert)
|
||||
{
|
||||
run_test(
|
||||
[](lt::session& ses) {},
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {},
|
||||
[](lt::session&) {},
|
||||
[](lt::session&, lt::torrent_handle, std::array<fake_peer*, 3>&) {},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
TEST_EQUAL(h.status().paused, false);
|
||||
h.pause();
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
TEST_EQUAL(h.status().paused, true);
|
||||
|
||||
std::vector<lt::alert*> alerts;
|
||||
|
@ -240,15 +240,15 @@ TORRENT_TEST(torrent_paused_alert)
|
|||
TORRENT_TEST(session_paused_alert)
|
||||
{
|
||||
run_test(
|
||||
[](lt::session& ses) {},
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {},
|
||||
[](lt::session&) {},
|
||||
[](lt::session&, lt::torrent_handle, std::array<fake_peer*, 3>&) {},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
TEST_EQUAL(h.status().paused, false);
|
||||
ses.pause();
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
TEST_EQUAL(h.status().paused, false);
|
||||
|
||||
std::vector<lt::alert*> alerts;
|
||||
|
@ -276,18 +276,18 @@ TORRENT_TEST(session_paused_alert)
|
|||
TORRENT_TEST(session_pause_resume)
|
||||
{
|
||||
run_test(
|
||||
[](lt::session& ses) {},
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&) {},
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
TEST_EQUAL(h.status().paused, false);
|
||||
ses.pause();
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
TEST_EQUAL(h.status().paused, false);
|
||||
ses.resume();
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
TEST_EQUAL(h.status().paused, false);
|
||||
|
||||
std::vector<lt::alert*> alerts;
|
||||
|
@ -315,8 +315,8 @@ TORRENT_TEST(session_pause_resume)
|
|||
TORRENT_TEST(session_pause_resume_connect)
|
||||
{
|
||||
run_test(
|
||||
[](lt::session& ses) {},
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&) {},
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>&) {
|
||||
TEST_EQUAL(h.status().paused, false);
|
||||
ses.pause();
|
||||
add_fake_peers(h, 3);
|
||||
|
@ -328,7 +328,7 @@ TORRENT_TEST(session_pause_resume_connect)
|
|||
ses.resume();
|
||||
},
|
||||
|
||||
[](lt::session& ses, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
[](lt::session&, lt::torrent_handle h, std::array<fake_peer*, 3>& test_peers) {
|
||||
TEST_EQUAL(h.status().paused, false);
|
||||
|
||||
check_accepted(test_peers, {{true, true, true}});
|
||||
|
|
|
@ -90,7 +90,7 @@ void run_test(Setup const& setup
|
|||
|
||||
// set up a timer to fire later, to verify everything we expected to happen
|
||||
// happened
|
||||
sim::timer t(sim, lt::seconds(100), [&](boost::system::error_code const& ec)
|
||||
sim::timer t(sim, lt::seconds(100), [&](boost::system::error_code const&)
|
||||
{
|
||||
std::fprintf(stderr, "shutting down\n");
|
||||
// shut down
|
||||
|
@ -111,14 +111,14 @@ TORRENT_TEST(socks5_tcp_accept)
|
|||
{
|
||||
set_proxy(ses, settings_pack::socks5);
|
||||
},
|
||||
[&](lt::session& ses, lt::alert const* alert) {
|
||||
[&](lt::session&, lt::alert const* alert) {
|
||||
if (auto* a = lt::alert_cast<lt::incoming_connection_alert>(alert))
|
||||
{
|
||||
TEST_EQUAL(a->socket_type, 2);
|
||||
incoming_connection = true;
|
||||
}
|
||||
},
|
||||
[](sim::simulation& sim, lt::session& ses
|
||||
[](sim::simulation& sim, lt::session&
|
||||
, boost::shared_ptr<lt::torrent_info> ti)
|
||||
{
|
||||
// test connecting to the client via its socks5 listen port
|
||||
|
@ -126,12 +126,12 @@ TORRENT_TEST(socks5_tcp_accept)
|
|||
fake_peer peer1(sim, "60.0.0.0");
|
||||
fake_peer peer2(sim, "60.0.0.1");
|
||||
|
||||
sim::timer t1(sim, lt::seconds(2), [&](boost::system::error_code const& ec)
|
||||
sim::timer t1(sim, lt::seconds(2), [&](boost::system::error_code const&)
|
||||
{
|
||||
peer1.connect_to(tcp::endpoint(addr("50.50.50.50"), 6881), ti->info_hash());
|
||||
});
|
||||
|
||||
sim::timer t2(sim, lt::seconds(3), [&](boost::system::error_code const& ec)
|
||||
sim::timer t2(sim, lt::seconds(3), [&](boost::system::error_code const&)
|
||||
{
|
||||
peer2.connect_to(tcp::endpoint(addr("50.50.50.50"), 6881), ti->info_hash());
|
||||
});
|
||||
|
@ -152,7 +152,7 @@ TORRENT_TEST(socks4_tcp_accept)
|
|||
{
|
||||
set_proxy(ses, settings_pack::socks4);
|
||||
},
|
||||
[&](lt::session& ses, lt::alert const* alert) {
|
||||
[&](lt::session&, lt::alert const* alert) {
|
||||
if (auto* a = lt::alert_cast<lt::incoming_connection_alert>(alert))
|
||||
{
|
||||
TEST_EQUAL(a->socket_type, 2);
|
||||
|
@ -160,12 +160,12 @@ TORRENT_TEST(socks4_tcp_accept)
|
|||
incoming_connection = true;
|
||||
}
|
||||
},
|
||||
[](sim::simulation& sim, lt::session& ses
|
||||
[](sim::simulation& sim, lt::session&
|
||||
, boost::shared_ptr<lt::torrent_info> ti)
|
||||
{
|
||||
fake_peer peer1(sim, "60.0.0.0");
|
||||
|
||||
sim::timer t1(sim, lt::seconds(2), [&](boost::system::error_code const& ec)
|
||||
sim::timer t1(sim, lt::seconds(2), [&](boost::system::error_code const&)
|
||||
{
|
||||
peer1.connect_to(tcp::endpoint(addr("50.50.50.50"), 6881), ti->info_hash());
|
||||
});
|
||||
|
@ -188,7 +188,7 @@ TORRENT_TEST(socks4_tcp_listen_alert)
|
|||
{
|
||||
set_proxy(ses, settings_pack::socks4);
|
||||
},
|
||||
[&](lt::session& ses, lt::alert const* alert) {
|
||||
[&](lt::session&, lt::alert const* alert) {
|
||||
if (auto* a = lt::alert_cast<lt::listen_succeeded_alert>(alert))
|
||||
{
|
||||
if (a->sock_type == listen_succeeded_alert::socks5)
|
||||
|
@ -199,7 +199,7 @@ TORRENT_TEST(socks4_tcp_listen_alert)
|
|||
}
|
||||
}
|
||||
},
|
||||
[](sim::simulation& sim, lt::session& ses
|
||||
[](sim::simulation& sim, lt::session&
|
||||
, boost::shared_ptr<lt::torrent_info> ti)
|
||||
{
|
||||
sim.run();
|
||||
|
@ -218,7 +218,7 @@ TORRENT_TEST(socks5_tcp_listen_alert)
|
|||
{
|
||||
set_proxy(ses, settings_pack::socks5);
|
||||
},
|
||||
[&](lt::session& ses, lt::alert const* alert) {
|
||||
[&](lt::session&, lt::alert const* alert) {
|
||||
if (auto* a = lt::alert_cast<lt::listen_succeeded_alert>(alert))
|
||||
{
|
||||
if (a->sock_type == listen_succeeded_alert::socks5)
|
||||
|
@ -229,7 +229,7 @@ TORRENT_TEST(socks5_tcp_listen_alert)
|
|||
}
|
||||
}
|
||||
},
|
||||
[](sim::simulation& sim, lt::session& ses
|
||||
[](sim::simulation& sim, lt::session&
|
||||
, boost::shared_ptr<lt::torrent_info> ti)
|
||||
{
|
||||
sim.run();
|
||||
|
@ -255,7 +255,7 @@ TORRENT_TEST(socks5_tcp_announce)
|
|||
params.save_path = ".";
|
||||
ses.async_add_torrent(params);
|
||||
},
|
||||
[&alert_port](lt::session& ses, lt::alert const* alert) {
|
||||
[&alert_port](lt::session&, lt::alert const* alert) {
|
||||
if (auto* a = lt::alert_cast<lt::listen_succeeded_alert>(alert))
|
||||
{
|
||||
if (a->sock_type == listen_succeeded_alert::socks5)
|
||||
|
@ -264,7 +264,7 @@ TORRENT_TEST(socks5_tcp_announce)
|
|||
}
|
||||
}
|
||||
},
|
||||
[&tracker_port](sim::simulation& sim, lt::session& ses
|
||||
[&tracker_port](sim::simulation& sim, lt::session&
|
||||
, boost::shared_ptr<lt::torrent_info> ti)
|
||||
{
|
||||
sim::asio::io_service web_server(sim, address_v4::from_string("2.2.2.2"));
|
||||
|
|
|
@ -41,15 +41,15 @@ TORRENT_TEST(super_seeding)
|
|||
{
|
||||
setup_swarm(5, swarm_test::upload
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {
|
||||
params.flags |= add_torrent_params::flag_super_seeding;
|
||||
}
|
||||
// on alert
|
||||
, [](lt::alert const* a, lt::session& ses) {}
|
||||
, [](lt::alert const*, lt::session&) {}
|
||||
// terminate
|
||||
, [](int ticks, lt::session& ses) -> bool
|
||||
, [](int, lt::session&) -> bool
|
||||
{ return true; });
|
||||
}
|
||||
|
||||
|
@ -65,9 +65,9 @@ TORRENT_TEST(strict_super_seeding)
|
|||
params.flags |= add_torrent_params::flag_super_seeding;
|
||||
}
|
||||
// on alert
|
||||
, [](lt::alert const* a, lt::session& ses) {}
|
||||
, [](lt::alert const*, lt::session&) {}
|
||||
// terminate
|
||||
, [](int ticks, lt::session& ses) -> bool
|
||||
, [](int, lt::session&) -> bool
|
||||
{ return true; });
|
||||
}
|
||||
|
||||
|
|
|
@ -46,15 +46,15 @@ TORRENT_TEST(seed_mode)
|
|||
// with seed mode
|
||||
setup_swarm(2, swarm_test::upload
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {
|
||||
params.flags |= add_torrent_params::flag_seed_mode;
|
||||
}
|
||||
// on alert
|
||||
, [](lt::alert const* a, lt::session& ses) {}
|
||||
, [](lt::alert const*, lt::session&) {}
|
||||
// terminate
|
||||
, [](int ticks, lt::session& ses) -> bool
|
||||
, [](int, lt::session&) -> bool
|
||||
{ return true; });
|
||||
}
|
||||
|
||||
|
@ -62,13 +62,13 @@ TORRENT_TEST(plain)
|
|||
{
|
||||
setup_swarm(2, swarm_test::download
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [](lt::alert const* a, lt::session& ses) {}
|
||||
, [](lt::alert const*, lt::session&) {}
|
||||
// terminate
|
||||
, [](int ticks, lt::session& ses) -> bool
|
||||
, [](int const ticks, lt::session& ses) -> bool
|
||||
{
|
||||
if (ticks > 80)
|
||||
{
|
||||
|
@ -93,11 +93,11 @@ TORRENT_TEST(session_stats)
|
|||
|
||||
setup_swarm(2, swarm_test::download
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [=](lt::alert const* a, lt::session& ses)
|
||||
, [=](lt::alert const* a, lt::session&)
|
||||
{
|
||||
auto const* ss = lt::alert_cast<session_stats_alert>(a);
|
||||
if (!ss) return;
|
||||
|
@ -108,7 +108,7 @@ TORRENT_TEST(session_stats)
|
|||
TEST_EQUAL(ss->values[incoming_extended_idx], 1);
|
||||
}
|
||||
// terminate
|
||||
, [](int ticks, lt::session& ses) -> bool
|
||||
, [](int const ticks, lt::session& ses) -> bool
|
||||
{
|
||||
ses.post_session_stats();
|
||||
if (ticks > 80)
|
||||
|
@ -133,9 +133,9 @@ TORRENT_TEST(suggest)
|
|||
pack.set_int(settings_pack::max_suggest_pieces, 10);
|
||||
}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [&num_suggests](lt::alert const* a, lt::session& ses) {
|
||||
, [&num_suggests](lt::alert const* a, lt::session&) {
|
||||
if (auto pl = alert_cast<peer_log_alert>(a))
|
||||
{
|
||||
if (pl->direction == peer_log_alert::outgoing_message
|
||||
|
@ -146,7 +146,7 @@ TORRENT_TEST(suggest)
|
|||
}
|
||||
}
|
||||
// terminate
|
||||
, [](int ticks, lt::session& ses) -> bool
|
||||
, [](int const ticks, lt::session&) -> bool
|
||||
{
|
||||
if (ticks > 500)
|
||||
{
|
||||
|
@ -174,11 +174,11 @@ TORRENT_TEST(utp_only)
|
|||
pack.set_bool(settings_pack::enable_outgoing_tcp, false);
|
||||
}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [](lt::alert const* a, lt::session& ses) {}
|
||||
, [](lt::alert const*, lt::session&) {}
|
||||
// terminate
|
||||
, [](int ticks, lt::session& ses) -> bool
|
||||
, [](int const ticks, lt::session& ses) -> bool
|
||||
{
|
||||
if (ticks > 80)
|
||||
{
|
||||
|
@ -204,7 +204,7 @@ void test_stop_start_download(swarm_test type, bool graceful)
|
|||
pack.set_int(settings_pack::min_reconnect_time, 0);
|
||||
}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {
|
||||
, [](lt::add_torrent_params&) {
|
||||
|
||||
}
|
||||
// on alert
|
||||
|
@ -222,7 +222,7 @@ void test_stop_start_download(swarm_test type, bool graceful)
|
|||
}
|
||||
}
|
||||
// terminate
|
||||
, [&](int ticks, lt::session& ses) -> bool
|
||||
, [&](int const ticks, lt::session& ses) -> bool
|
||||
{
|
||||
if (paused_once == false)
|
||||
{
|
||||
|
@ -275,11 +275,11 @@ TORRENT_TEST(stop_start_download_graceful_no_peers)
|
|||
|
||||
setup_swarm(1, swarm_test::download
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [&](lt::alert const* a, lt::session& ses) {
|
||||
, [&](lt::alert const* a, lt::session&) {
|
||||
if (auto tp = lt::alert_cast<lt::torrent_paused_alert>(a))
|
||||
{
|
||||
TEST_EQUAL(resumed, false);
|
||||
|
@ -289,7 +289,7 @@ TORRENT_TEST(stop_start_download_graceful_no_peers)
|
|||
}
|
||||
}
|
||||
// terminate
|
||||
, [&](int ticks, lt::session& ses) -> bool
|
||||
, [&](int const ticks, lt::session& ses) -> bool
|
||||
{
|
||||
if (paused_once == false
|
||||
&& ticks == 6)
|
||||
|
@ -327,13 +327,13 @@ TORRENT_TEST(shutdown)
|
|||
{
|
||||
setup_swarm(2, swarm_test::download
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [](lt::alert const* a, lt::session& ses) {}
|
||||
, [](lt::alert const*, lt::session&) {}
|
||||
// terminate
|
||||
, [](int ticks, lt::session& ses) -> bool
|
||||
, [](int, lt::session& ses) -> bool
|
||||
{
|
||||
if (completed_pieces(ses) == 0) return false;
|
||||
TEST_EQUAL(is_seed(ses), false);
|
||||
|
@ -347,13 +347,13 @@ TORRENT_TEST(delete_files)
|
|||
|
||||
setup_swarm(2, swarm_test::download
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [](lt::alert const* a, lt::session& ses) {}
|
||||
, [](lt::alert const*, lt::session&) {}
|
||||
// terminate
|
||||
, [&save_path](int ticks, lt::session& ses) -> bool
|
||||
, [&save_path](int, lt::session& ses) -> bool
|
||||
{
|
||||
if (completed_pieces(ses) == 0) return false;
|
||||
|
||||
|
@ -379,13 +379,13 @@ TORRENT_TEST(delete_partfile)
|
|||
std::string save_path;
|
||||
setup_swarm(2, swarm_test::download
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [](lt::alert const* a, lt::session& ses) {}
|
||||
, [](lt::alert const* a, lt::session&) {}
|
||||
// terminate
|
||||
, [&save_path](int ticks, lt::session& ses) -> bool
|
||||
, [&save_path](int, lt::session& ses) -> bool
|
||||
{
|
||||
if (completed_pieces(ses) == 0) return false;
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ TORRENT_TEST(disk_io_thread_pool_idle_reaping)
|
|||
// the thread will be killed the second time the reaper runs and we need
|
||||
// to wait one extra minute to make sure the check runs after the reaper
|
||||
idle_delay.expires_from_now(std::chrono::minutes(3));
|
||||
idle_delay.async_wait([&](lt::error_code ec)
|
||||
idle_delay.async_wait([&](lt::error_code const&)
|
||||
{
|
||||
// this is a kludge to work around a race between the thread
|
||||
// exiting and checking the number of threads
|
||||
|
@ -148,7 +148,7 @@ TORRENT_TEST(disk_io_thread_pool_idle_reaping)
|
|||
// now kill the rest
|
||||
threads.set_active_threads(0);
|
||||
idle_delay.expires_from_now(std::chrono::minutes(3));
|
||||
idle_delay.async_wait([&](lt::error_code ec)
|
||||
idle_delay.async_wait([&](lt::error_code const&)
|
||||
{
|
||||
// see comment above about this kludge
|
||||
threads.wait_for_thread_exit(0);
|
||||
|
|
|
@ -48,11 +48,11 @@ TORRENT_TEST(status_timers)
|
|||
|
||||
setup_swarm(1, swarm_test::upload
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params&) {}
|
||||
// on alert
|
||||
, [&](lt::alert const* a, lt::session& ses) {
|
||||
, [&](lt::alert const* a, lt::session&) {
|
||||
if (auto ta = alert_cast<torrent_added_alert>(a))
|
||||
{
|
||||
TEST_CHECK(!handle.is_valid());
|
||||
|
@ -61,7 +61,7 @@ TORRENT_TEST(status_timers)
|
|||
}
|
||||
}
|
||||
// terminate
|
||||
, [&](int ticks, lt::session& ses) -> bool
|
||||
, [&](int ticks, lt::session&) -> bool
|
||||
{
|
||||
|
||||
// simulate 20 hours of uptime. Currently, the session_time and internal
|
||||
|
@ -75,7 +75,7 @@ TORRENT_TEST(status_timers)
|
|||
if ((ticks % 3600) == 0)
|
||||
{
|
||||
lt::time_point now = lt::clock_type::now();
|
||||
int since_start = total_seconds(now - start_time) - 1;
|
||||
int const since_start = int(total_seconds(now - start_time) - 1);
|
||||
torrent_status st = handle.status();
|
||||
TEST_EQUAL(st.active_time, since_start);
|
||||
TEST_EQUAL(st.seeding_time, since_start);
|
||||
|
@ -115,9 +115,9 @@ TORRENT_TEST(alert_order)
|
|||
sett.set_int(settings_pack::alert_mask, alert::all_categories);
|
||||
}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {}
|
||||
, [](lt::add_torrent_params ) {}
|
||||
// on alert
|
||||
, [&](lt::alert const* a, lt::session& ses) {
|
||||
, [&](lt::alert const* a, lt::session&) {
|
||||
if (auto ta = alert_cast<add_torrent_alert>(a))
|
||||
{
|
||||
TEST_EQUAL(received_add_torrent_alert, false);
|
||||
|
@ -133,7 +133,7 @@ TORRENT_TEST(alert_order)
|
|||
}
|
||||
}
|
||||
// terminate
|
||||
, [&](int ticks, lt::session& ses) -> bool
|
||||
, [&](int ticks, lt::session&) -> bool
|
||||
{ return ticks > 10; }
|
||||
);
|
||||
|
||||
|
|
|
@ -68,15 +68,16 @@ void test_interval(int interval)
|
|||
std::vector<int> announces;
|
||||
|
||||
http.register_handler("/announce"
|
||||
, [&announces,interval,start](std::string method, std::string req
|
||||
, std::map<std::string, std::string>&)
|
||||
, [&announces,interval,start](std::string /* method */
|
||||
, std::string /* req */
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
std::uint32_t seconds = chrono::duration_cast<lt::seconds>(
|
||||
lt::clock_type::now() - start).count();
|
||||
std::uint32_t const seconds = std::uint32_t(chrono::duration_cast<lt::seconds>(
|
||||
lt::clock_type::now() - start).count());
|
||||
announces.push_back(seconds);
|
||||
|
||||
char response[500];
|
||||
int size = std::snprintf(response, sizeof(response), "d8:intervali%de5:peers0:e", interval);
|
||||
int const size = std::snprintf(response, sizeof(response), "d8:intervali%de5:peers0:e", interval);
|
||||
return sim::send_response(200, "OK", size) + response;
|
||||
});
|
||||
|
||||
|
@ -87,24 +88,24 @@ void test_interval(int interval)
|
|||
|
||||
setup_swarm(1, swarm_test::upload, sim, default_settings, default_add_torrent
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) { }
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {
|
||||
params.trackers.push_back("http://2.2.2.2:8080/announce");
|
||||
}
|
||||
// on alert
|
||||
, [&](lt::alert const* a, lt::session& ses) {
|
||||
, [&](lt::alert const* a, lt::session&) {
|
||||
|
||||
if (lt::alert_cast<lt::tracker_announce_alert>(a))
|
||||
{
|
||||
std::uint32_t seconds = chrono::duration_cast<lt::seconds>(
|
||||
a->timestamp() - start).count();
|
||||
std::uint32_t const seconds = std::uint32_t(chrono::duration_cast<lt::seconds>(
|
||||
a->timestamp() - start).count());
|
||||
|
||||
announce_alerts.push_back(seconds);
|
||||
}
|
||||
}
|
||||
// terminate
|
||||
, [](int ticks, lt::session& ses) -> bool { return ticks > duration; });
|
||||
, [](int const ticks, lt::session&) -> bool { return ticks > duration; });
|
||||
|
||||
TEST_EQUAL(announce_alerts.size(), announces.size());
|
||||
|
||||
|
@ -139,12 +140,12 @@ TORRENT_TEST(event_completed)
|
|||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
TEST_EQUAL(method, "GET");
|
||||
int timestamp = chrono::duration_cast<lt::seconds>(
|
||||
lt::clock_type::now() - start).count();
|
||||
int const timestamp = int(chrono::duration_cast<lt::seconds>(
|
||||
lt::clock_type::now() - start).count());
|
||||
announces.push_back({timestamp, req});
|
||||
|
||||
char response[500];
|
||||
int size = std::snprintf(response, sizeof(response), "d8:intervali%de5:peers0:e", interval);
|
||||
int const size = std::snprintf(response, sizeof(response), "d8:intervali%de5:peers0:e", interval);
|
||||
return sim::send_response(200, "OK", size) + response;
|
||||
});
|
||||
|
||||
|
@ -155,20 +156,20 @@ TORRENT_TEST(event_completed)
|
|||
|
||||
setup_swarm(2, swarm_test::download, sim, default_settings, default_add_torrent
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) { }
|
||||
, [](lt::settings_pack&) { }
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {
|
||||
params.trackers.push_back("http://2.2.2.2:8080/announce");
|
||||
}
|
||||
// on alert
|
||||
, [&](lt::alert const* a, lt::session& ses) {}
|
||||
, [&](lt::alert const*, lt::session&) {}
|
||||
// terminate
|
||||
, [&](int ticks, lt::session& ses) -> bool
|
||||
, [&](int const ticks, lt::session& ses) -> bool
|
||||
{
|
||||
if (completion == -1 && is_seed(ses))
|
||||
{
|
||||
completion = chrono::duration_cast<lt::seconds>(
|
||||
lt::clock_type::now() - start).count();
|
||||
completion = int(chrono::duration_cast<lt::seconds>(
|
||||
lt::clock_type::now() - start).count());
|
||||
}
|
||||
|
||||
return ticks > duration;
|
||||
|
@ -268,7 +269,8 @@ void on_alert_notify(lt::session* ses)
|
|||
for (lt::alert* a : alerts)
|
||||
{
|
||||
lt::time_duration d = a->timestamp().time_since_epoch();
|
||||
std::uint32_t millis = lt::duration_cast<lt::milliseconds>(d).count();
|
||||
std::uint32_t const millis = std::uint32_t(
|
||||
lt::duration_cast<lt::milliseconds>(d).count());
|
||||
std::printf("%4d.%03d: %s\n", millis / 1000, millis % 1000,
|
||||
a->message().c_str());
|
||||
}
|
||||
|
@ -301,7 +303,7 @@ TORRENT_TEST(ipv6_support)
|
|||
TEST_EQUAL(method, "GET");
|
||||
|
||||
char response[500];
|
||||
int size = std::snprintf(response, sizeof(response), "d8:intervali1800e5:peers0:e");
|
||||
int const size = std::snprintf(response, sizeof(response), "d8:intervali1800e5:peers0:e");
|
||||
return sim::send_response(200, "OK", size) + response;
|
||||
});
|
||||
|
||||
|
@ -313,7 +315,7 @@ TORRENT_TEST(ipv6_support)
|
|||
TEST_EQUAL(method, "GET");
|
||||
|
||||
char response[500];
|
||||
int size = std::snprintf(response, sizeof(response), "d8:intervali1800e5:peers0:e");
|
||||
int const size = std::snprintf(response, sizeof(response), "d8:intervali1800e5:peers0:e");
|
||||
return sim::send_response(200, "OK", size) + response;
|
||||
});
|
||||
|
||||
|
@ -338,7 +340,7 @@ TORRENT_TEST(ipv6_support)
|
|||
|
||||
// stop the torrent 5 seconds in
|
||||
sim::timer t1(sim, lt::seconds(5)
|
||||
, [&ses](boost::system::error_code const& ec)
|
||||
, [&ses](boost::system::error_code const&)
|
||||
{
|
||||
std::vector<lt::torrent_handle> torrents = ses->get_torrents();
|
||||
for (auto const& t : torrents)
|
||||
|
@ -349,7 +351,7 @@ TORRENT_TEST(ipv6_support)
|
|||
|
||||
// then shut down 10 seconds in
|
||||
sim::timer t2(sim, lt::seconds(10)
|
||||
, [&ses,&zombie](boost::system::error_code const& ec)
|
||||
, [&ses,&zombie](boost::system::error_code const&)
|
||||
{
|
||||
zombie = ses->abort();
|
||||
ses->set_alert_notify([]{});
|
||||
|
@ -405,7 +407,7 @@ void tracker_test(Setup setup, Announce a, Test1 test1, Test2 test2
|
|||
|
||||
// run the test 5 seconds in
|
||||
sim::timer t1(sim, lt::seconds(5)
|
||||
, [&ses,&test1](boost::system::error_code const& ec)
|
||||
, [&ses,&test1](boost::system::error_code const&)
|
||||
{
|
||||
std::vector<lt::torrent_handle> torrents = ses->get_torrents();
|
||||
TEST_EQUAL(torrents.size(), 1);
|
||||
|
@ -414,7 +416,7 @@ void tracker_test(Setup setup, Announce a, Test1 test1, Test2 test2
|
|||
});
|
||||
|
||||
sim::timer t2(sim, lt::seconds(5 + delay)
|
||||
, [&ses,&test2](boost::system::error_code const& ec)
|
||||
, [&ses,&test2](boost::system::error_code const&)
|
||||
{
|
||||
std::vector<lt::torrent_handle> torrents = ses->get_torrents();
|
||||
TEST_EQUAL(torrents.size(), 1);
|
||||
|
@ -424,7 +426,7 @@ void tracker_test(Setup setup, Announce a, Test1 test1, Test2 test2
|
|||
|
||||
// then shut down 10 seconds in
|
||||
sim::timer t3(sim, lt::seconds(10 + delay)
|
||||
, [&ses,&zombie](boost::system::error_code const& ec)
|
||||
, [&ses,&zombie](boost::system::error_code const&)
|
||||
{
|
||||
zombie = ses->abort();
|
||||
ses->set_alert_notify([]{});
|
||||
|
@ -463,12 +465,12 @@ TORRENT_TEST(test_error)
|
|||
{
|
||||
announce_entry_test(
|
||||
[](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
TEST_EQUAL(method, "GET");
|
||||
|
||||
char response[500];
|
||||
int size = std::snprintf(response, sizeof(response), "d14:failure reason4:teste");
|
||||
int const size = std::snprintf(response, sizeof(response), "d14:failure reason4:teste");
|
||||
return sim::send_response(200, "OK", size) + response;
|
||||
}
|
||||
, [](announce_entry const& ae)
|
||||
|
@ -486,12 +488,12 @@ TORRENT_TEST(test_warning)
|
|||
{
|
||||
announce_entry_test(
|
||||
[](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
TEST_EQUAL(method, "GET");
|
||||
|
||||
char response[500];
|
||||
int size = std::snprintf(response, sizeof(response), "d5:peers6:aaaaaa15:warning message5:test2e");
|
||||
int const size = std::snprintf(response, sizeof(response), "d5:peers6:aaaaaa15:warning message5:test2e");
|
||||
return sim::send_response(200, "OK", size) + response;
|
||||
}
|
||||
, [](announce_entry const& ae)
|
||||
|
@ -508,12 +510,12 @@ TORRENT_TEST(test_scrape_data_in_announce)
|
|||
{
|
||||
announce_entry_test(
|
||||
[](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
TEST_EQUAL(method, "GET");
|
||||
|
||||
char response[500];
|
||||
int size = std::snprintf(response, sizeof(response),
|
||||
int const size = std::snprintf(response, sizeof(response),
|
||||
"d5:peers6:aaaaaa8:completei1e10:incompletei2e10:downloadedi3e11:downloadersi4ee");
|
||||
return sim::send_response(200, "OK", size) + response;
|
||||
}
|
||||
|
@ -534,12 +536,12 @@ TORRENT_TEST(test_scrape)
|
|||
{
|
||||
tracker_test(
|
||||
[](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
TEST_EQUAL(method, "GET");
|
||||
|
||||
char response[500];
|
||||
int size = std::snprintf(response, sizeof(response),
|
||||
int const size = std::snprintf(response, sizeof(response),
|
||||
"d5:filesd20:ababababababababababd8:completei1e10:downloadedi3e10:incompletei2eeee");
|
||||
return sim::send_response(200, "OK", size) + response;
|
||||
}
|
||||
|
@ -564,7 +566,7 @@ TORRENT_TEST(test_http_status)
|
|||
{
|
||||
announce_entry_test(
|
||||
[](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
TEST_EQUAL(method, "GET");
|
||||
return sim::send_response(410, "Not A Tracker", 0);
|
||||
|
@ -583,11 +585,11 @@ TORRENT_TEST(test_interval)
|
|||
{
|
||||
announce_entry_test(
|
||||
[](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
TEST_EQUAL(method, "GET");
|
||||
char response[500];
|
||||
int size = std::snprintf(response, sizeof(response)
|
||||
int const size = std::snprintf(response, sizeof(response)
|
||||
, "d10:tracker id8:testteste");
|
||||
return sim::send_response(200, "OK", size) + response;
|
||||
}
|
||||
|
@ -607,11 +609,11 @@ TORRENT_TEST(test_invalid_bencoding)
|
|||
{
|
||||
announce_entry_test(
|
||||
[](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
TEST_EQUAL(method, "GET");
|
||||
char response[500];
|
||||
int size = std::snprintf(response, sizeof(response)
|
||||
int const size = std::snprintf(response, sizeof(response)
|
||||
, "d10:tracer idteste");
|
||||
return sim::send_response(200, "OK", size) + response;
|
||||
}
|
||||
|
@ -643,14 +645,14 @@ TORRENT_TEST(try_next)
|
|||
return 60;
|
||||
},
|
||||
[&](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
got_announce = true;
|
||||
TEST_EQUAL(method, "GET");
|
||||
|
||||
char response[500];
|
||||
// respond with an empty peer list
|
||||
int size = std::snprintf(response, sizeof(response), "d5:peers0:e");
|
||||
int const size = std::snprintf(response, sizeof(response), "d5:peers0:e");
|
||||
return sim::send_response(200, "OK", size) + response;
|
||||
}
|
||||
, [](torrent_handle h) {}
|
||||
|
@ -729,7 +731,7 @@ TORRENT_TEST(tracker_ipv6_argument)
|
|||
return 60;
|
||||
},
|
||||
[&](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
got_announce = true;
|
||||
bool const stop_event = req.find("&event=stopped") != std::string::npos;
|
||||
|
@ -739,8 +741,8 @@ TORRENT_TEST(tracker_ipv6_argument)
|
|||
got_ipv6 |= pos != std::string::npos;
|
||||
return sim::send_response(200, "OK", 11) + "d5:peers0:e";
|
||||
}
|
||||
, [](torrent_handle h) {}
|
||||
, [](torrent_handle h) {});
|
||||
, [](torrent_handle) {}
|
||||
, [](torrent_handle) {});
|
||||
TEST_EQUAL(got_announce, true);
|
||||
TEST_EQUAL(got_ipv6, true);
|
||||
}
|
||||
|
@ -761,7 +763,7 @@ TORRENT_TEST(tracker_ipv6_argument_non_private)
|
|||
return 60;
|
||||
},
|
||||
[&](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
got_announce = true;
|
||||
std::string::size_type pos = req.find("&ipv6=");
|
||||
|
@ -769,8 +771,8 @@ TORRENT_TEST(tracker_ipv6_argument_non_private)
|
|||
got_ipv6 |= pos != std::string::npos;
|
||||
return sim::send_response(200, "OK", 11) + "d5:peers0:e";
|
||||
}
|
||||
, [](torrent_handle h) {}
|
||||
, [](torrent_handle h) {});
|
||||
, [](torrent_handle) {}
|
||||
, [](torrent_handle) {});
|
||||
TEST_EQUAL(got_announce, true);
|
||||
TEST_EQUAL(got_ipv6, false);
|
||||
}
|
||||
|
@ -789,7 +791,7 @@ TORRENT_TEST(tracker_ipv6_argument_privacy_mode)
|
|||
return 60;
|
||||
},
|
||||
[&](std::string method, std::string req
|
||||
, std::map<std::string, std::string>& headers)
|
||||
, std::map<std::string, std::string>&)
|
||||
{
|
||||
got_announce = true;
|
||||
std::string::size_type pos = req.find("&ipv6=");
|
||||
|
@ -797,8 +799,8 @@ TORRENT_TEST(tracker_ipv6_argument_privacy_mode)
|
|||
got_ipv6 |= pos != std::string::npos;
|
||||
return sim::send_response(200, "OK", 11) + "d5:peers0:e";
|
||||
}
|
||||
, [](torrent_handle h) {}
|
||||
, [](torrent_handle h) {});
|
||||
, [](torrent_handle) {}
|
||||
, [](torrent_handle) {});
|
||||
TEST_EQUAL(got_announce, true);
|
||||
TEST_EQUAL(got_ipv6, false);
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ TORRENT_TEST(plain)
|
|||
ses.add_extension(&create_lt_trackers_plugin);
|
||||
}
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {
|
||||
|
||||
|
@ -80,7 +80,7 @@ TORRENT_TEST(plain)
|
|||
params.trackers.clear();
|
||||
}
|
||||
// on alert
|
||||
, [&](lt::alert const* a, lt::session& ses) {
|
||||
, [&](lt::alert const* a, lt::session&) {
|
||||
if (alert_cast<lt::peer_connect_alert>(a))
|
||||
connected = true;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ TORRENT_TEST(no_metadata)
|
|||
ses.add_extension(&create_lt_trackers_plugin);
|
||||
}
|
||||
// add session
|
||||
, [](lt::settings_pack& pack) {}
|
||||
, [](lt::settings_pack&) {}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params& params) {
|
||||
|
||||
|
@ -139,12 +139,12 @@ TORRENT_TEST(no_metadata)
|
|||
params.ti.reset();
|
||||
}
|
||||
// on alert
|
||||
, [&](lt::alert const* a, lt::session& ses) {
|
||||
, [&](lt::alert const* a, lt::session&) {
|
||||
if (alert_cast<lt::peer_connect_alert>(a))
|
||||
connected = true;
|
||||
}
|
||||
// terminate
|
||||
, [](int ticks, lt::session& ses) -> bool {
|
||||
, [](int const ticks, lt::session& ses) -> bool {
|
||||
if (ticks < 10)
|
||||
return false;
|
||||
TEST_EQUAL(ses.get_torrents()[0].trackers().size(), 0);
|
||||
|
|
|
@ -170,7 +170,7 @@ TORRENT_TEST(socks4_tcp)
|
|||
set_proxy(ses0, settings_pack::socks4);
|
||||
filter_ips(ses1);
|
||||
},
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ TORRENT_TEST(socks5_tcp_connect)
|
|||
set_proxy(ses0, settings_pack::socks5);
|
||||
filter_ips(ses1);
|
||||
},
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ TORRENT_TEST(socks5_tcp_accept)
|
|||
set_proxy(ses1, settings_pack::socks5);
|
||||
filter_ips(ses0);
|
||||
},
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
},
|
||||
|
@ -219,7 +219,7 @@ TORRENT_TEST(encryption_tcp)
|
|||
run_test(
|
||||
[](lt::session& ses0, lt::session& ses1)
|
||||
{ enable_enc(ses0); enable_enc(ses1); },
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
}
|
||||
|
@ -230,8 +230,8 @@ TORRENT_TEST(no_proxy_tcp_ipv6)
|
|||
{
|
||||
using namespace libtorrent;
|
||||
run_test(
|
||||
[](lt::session& ses0, lt::session& ses1) {},
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::session&) {},
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
},
|
||||
|
@ -243,8 +243,8 @@ TORRENT_TEST(no_proxy_utp_ipv6)
|
|||
{
|
||||
using namespace libtorrent;
|
||||
run_test(
|
||||
[](lt::session& ses0, lt::session& ses1) {},
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::session&) {},
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
},
|
||||
|
@ -263,7 +263,7 @@ TORRENT_TEST(socks5_tcp_ipv6)
|
|||
set_proxy(ses0, settings_pack::socks5);
|
||||
filter_ips(ses1);
|
||||
},
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
},
|
||||
|
@ -276,8 +276,8 @@ TORRENT_TEST(no_proxy_tcp)
|
|||
{
|
||||
using namespace libtorrent;
|
||||
run_test(
|
||||
[](lt::session& ses0, lt::session& ses1) {},
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::session&) {},
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
}
|
||||
|
@ -288,8 +288,8 @@ TORRENT_TEST(no_proxy_utp)
|
|||
{
|
||||
using namespace libtorrent;
|
||||
run_test(
|
||||
[](lt::session& ses0, lt::session& ses1) {},
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::session&) {},
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ TORRENT_TEST(encryption_utp)
|
|||
run_test(
|
||||
[](lt::session& ses0, lt::session& ses1)
|
||||
{ enable_enc(ses0); enable_enc(ses1); utp_only(ses0); },
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ TORRENT_TEST(socks5_utp)
|
|||
utp_only(ses0);
|
||||
filter_ips(ses1);
|
||||
},
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
}
|
||||
|
@ -338,8 +338,8 @@ TORRENT_TEST(no_proxy_tcp_banned)
|
|||
{
|
||||
using namespace libtorrent;
|
||||
run_test(
|
||||
[](lt::session& ses0, lt::session& ses1) { filter_ips(ses1); },
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::session& ses1) { filter_ips(ses1); },
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), false);
|
||||
}
|
||||
|
@ -350,8 +350,8 @@ TORRENT_TEST(no_proxy_utp_banned)
|
|||
{
|
||||
using namespace libtorrent;
|
||||
run_test(
|
||||
[](lt::session& ses0, lt::session& ses1) { filter_ips(ses1); },
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session&, lt::session& ses1) { filter_ips(ses1); },
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), false);
|
||||
}
|
||||
|
@ -362,8 +362,8 @@ TORRENT_TEST(auto_disk_cache_size)
|
|||
{
|
||||
using namespace libtorrent;
|
||||
run_test(
|
||||
[](lt::session& ses0, lt::session& ses1) { set_cache_size(ses0, -1); },
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session& ses0, lt::session&) { set_cache_size(ses0, -1); },
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
|
||||
|
@ -379,8 +379,8 @@ TORRENT_TEST(disable_disk_cache)
|
|||
{
|
||||
using namespace libtorrent;
|
||||
run_test(
|
||||
[](lt::session& ses0, lt::session& ses1) { set_cache_size(ses0, 0); },
|
||||
[](lt::session& ses, lt::alert const* alert) {},
|
||||
[](lt::session& ses0, lt::session&) { set_cache_size(ses0, 0); },
|
||||
[](lt::session&, lt::alert const*) {},
|
||||
[](std::shared_ptr<lt::session> ses[2]) {
|
||||
TEST_EQUAL(is_seed(*ses[0]), true);
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ TORRENT_TEST(utp)
|
|||
params.flags |= add_torrent_params::flag_seed_mode;
|
||||
}
|
||||
// on alert
|
||||
, [&](lt::alert const* a, lt::session& ses) {
|
||||
, [&](lt::alert const*, lt::session& ses) {
|
||||
if (!is_seed(ses)) return;
|
||||
|
||||
// if this check fails, there is a performance regression in the protocol,
|
||||
|
@ -76,7 +76,7 @@ TORRENT_TEST(utp)
|
|||
TEST_CHECK(lt::clock_type::now() < start_time + lt::milliseconds(8500));
|
||||
}
|
||||
// terminate
|
||||
, [](int ticks, lt::session& ses) -> bool
|
||||
, [](int const ticks, lt::session&) -> bool
|
||||
{
|
||||
if (ticks > 100)
|
||||
{
|
||||
|
|
|
@ -84,7 +84,7 @@ int get_cache_size(lt::session& ses)
|
|||
ses.post_session_stats();
|
||||
std::vector<alert*> alerts;
|
||||
ses.pop_alerts(&alerts);
|
||||
int cache_size = -1;
|
||||
boost::int64_t cache_size = -1;
|
||||
for (auto const a : alerts)
|
||||
{
|
||||
if (auto const* st = alert_cast<session_stats_alert>(a))
|
||||
|
@ -94,7 +94,8 @@ int get_cache_size(lt::session& ses)
|
|||
break;
|
||||
}
|
||||
}
|
||||
return cache_size;
|
||||
TEST_CHECK(cache_size < std::numeric_limits<int>::max());
|
||||
return int(cache_size);
|
||||
}
|
||||
|
||||
void set_proxy(lt::session& ses, int proxy_type, int flags, bool proxy_peer_connections)
|
||||
|
|
|
@ -61,5 +61,5 @@ void set_proxy(lt::session& ses, int proxy_type, int flags = 0
|
|||
|
||||
void print_alerts(lt::session& ses
|
||||
, std::function<void(lt::session&, lt::alert const*)> on_alert
|
||||
= [](lt::session& ses, lt::alert const* a) {});
|
||||
= [](lt::session&, lt::alert const*) {});
|
||||
|
||||
|
|
|
@ -1023,7 +1023,8 @@ void utp_stream::add_write_buffer(void const* buf, size_t len)
|
|||
for (std::vector<utp_socket_impl::iovec_t>::iterator i = m_impl->m_write_buffer.begin()
|
||||
, end(m_impl->m_write_buffer.end()); i != end; ++i)
|
||||
{
|
||||
write_buffer_size += i->len;
|
||||
TORRENT_ASSERT(std::numeric_limits<int>::max() - i->len > write_buffer_size);
|
||||
write_buffer_size += int(i->len);
|
||||
}
|
||||
TORRENT_ASSERT(m_impl->m_write_buffer_size == write_buffer_size);
|
||||
#endif
|
||||
|
@ -1036,7 +1037,8 @@ void utp_stream::add_write_buffer(void const* buf, size_t len)
|
|||
for (std::vector<utp_socket_impl::iovec_t>::iterator i = m_impl->m_write_buffer.begin()
|
||||
, end(m_impl->m_write_buffer.end()); i != end; ++i)
|
||||
{
|
||||
write_buffer_size += i->len;
|
||||
TORRENT_ASSERT(std::numeric_limits<int>::max() - i->len > write_buffer_size);
|
||||
write_buffer_size += int(i->len);
|
||||
}
|
||||
TORRENT_ASSERT(m_impl->m_write_buffer_size == write_buffer_size);
|
||||
#endif
|
||||
|
@ -1626,7 +1628,8 @@ void utp_socket_impl::write_payload(std::uint8_t* ptr, int size)
|
|||
for (std::vector<iovec_t>::iterator i = m_write_buffer.begin()
|
||||
, end(m_write_buffer.end()); i != end; ++i)
|
||||
{
|
||||
write_buffer_size += i->len;
|
||||
TORRENT_ASSERT(std::numeric_limits<int>::max() - i->len > write_buffer_size);
|
||||
write_buffer_size += int(i->len);
|
||||
}
|
||||
TORRENT_ASSERT(m_write_buffer_size == write_buffer_size);
|
||||
#endif
|
||||
|
@ -1664,7 +1667,8 @@ void utp_socket_impl::write_payload(std::uint8_t* ptr, int size)
|
|||
for (std::vector<iovec_t>::iterator j = m_write_buffer.begin()
|
||||
, end(m_write_buffer.end()); j != end; ++j)
|
||||
{
|
||||
write_buffer_size += j->len;
|
||||
TORRENT_ASSERT(std::numeric_limits<int>::max() - j->len > write_buffer_size);
|
||||
write_buffer_size += int(j->len);
|
||||
}
|
||||
TORRENT_ASSERT(m_write_buffer_size == write_buffer_size);
|
||||
#endif
|
||||
|
|
|
@ -101,7 +101,7 @@ void peer_conn::on_connect(error_code const& ec)
|
|||
, std::bind(&peer_conn::on_handshake, this, h, _1, _2));
|
||||
}
|
||||
|
||||
void peer_conn::on_handshake(char* h, error_code const& ec, size_t bytes_transferred)
|
||||
void peer_conn::on_handshake(char* h, error_code const& ec, size_t)
|
||||
{
|
||||
free(h);
|
||||
if (ec)
|
||||
|
@ -115,7 +115,7 @@ void peer_conn::on_handshake(char* h, error_code const& ec, size_t bytes_transfe
|
|||
, std::bind(&peer_conn::on_handshake2, this, _1, _2));
|
||||
}
|
||||
|
||||
void peer_conn::on_handshake2(error_code const& ec, size_t bytes_transferred)
|
||||
void peer_conn::on_handshake2(error_code const& ec, size_t)
|
||||
{
|
||||
if (ec)
|
||||
{
|
||||
|
@ -173,7 +173,7 @@ void peer_conn::write_have_all()
|
|||
}
|
||||
}
|
||||
|
||||
void peer_conn::on_have_all_sent(error_code const& ec, size_t bytes_transferred)
|
||||
void peer_conn::on_have_all_sent(error_code const& ec, size_t)
|
||||
{
|
||||
if (ec)
|
||||
{
|
||||
|
@ -247,7 +247,7 @@ bool peer_conn::write_request()
|
|||
return true;
|
||||
}
|
||||
|
||||
void peer_conn::on_req_sent(char* m, error_code const& ec, size_t bytes_transferred)
|
||||
void peer_conn::on_req_sent(char* m, error_code const& ec, size_t)
|
||||
{
|
||||
free(m);
|
||||
if (ec)
|
||||
|
@ -307,7 +307,7 @@ void peer_conn::work_download()
|
|||
, std::bind(&peer_conn::on_msg_length, this, _1, _2));
|
||||
}
|
||||
|
||||
void peer_conn::on_msg_length(error_code const& ec, size_t bytes_transferred)
|
||||
void peer_conn::on_msg_length(error_code const& ec, size_t)
|
||||
{
|
||||
using namespace libtorrent::detail;
|
||||
|
||||
|
|
|
@ -149,7 +149,6 @@ LONG WINAPI seh_exception_handler(LPEXCEPTION_POINTERS p)
|
|||
output_test_log_to_terminal();
|
||||
|
||||
exit(code);
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
|
@ -134,7 +134,7 @@ boost::shared_ptr<libtorrent::torrent_info> make_test_torrent(
|
|||
hasher h;
|
||||
int const piece_size = (i < num_pieces - 1) ? piece_length : total_size - (num_pieces - 1) * piece_length;
|
||||
|
||||
char const data = i;
|
||||
char const data = char(i & 0xff);
|
||||
char const zero = 0;
|
||||
for (int o = 0; o < piece_size; ++o, ++torrent_offset)
|
||||
{
|
||||
|
@ -186,7 +186,7 @@ void generate_files(libtorrent::torrent_info const& ti, std::string const& path
|
|||
int const piece_size = ti.piece_size(i);
|
||||
buffer.resize(ti.piece_length());
|
||||
|
||||
std::uint8_t const data = alternate_data ? 255 - i : i;
|
||||
std::uint8_t const data = std::uint8_t((alternate_data ? 255 - i : i) & 0xff);
|
||||
for (int o = 0; o < piece_size; ++o)
|
||||
{
|
||||
memcpy(&buffer[o], &data, 1);
|
||||
|
|
|
@ -101,7 +101,7 @@ sha1_hash rand_hash()
|
|||
{
|
||||
sha1_hash ret;
|
||||
for (int i = 0; i < 20; ++i)
|
||||
ret[i] = lt::random();
|
||||
ret[i] = boost::uint8_t(lt::random() & 0xff);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,8 @@ sha1_hash rand_hash()
|
|||
address rand_v6()
|
||||
{
|
||||
address_v6::bytes_type bytes;
|
||||
for (int i = 0; i < int(bytes.size()); ++i) bytes[i] = lt::random();
|
||||
for (int i = 0; i < int(bytes.size()); ++i)
|
||||
bytes[i] = boost::uint8_t(lt::random() & 0xff);
|
||||
return address_v6(bytes);
|
||||
}
|
||||
#endif
|
||||
|
@ -172,28 +173,27 @@ bool should_print(lt::alert* a)
|
|||
}
|
||||
alert const* wait_for_alert(lt::session& ses, int type, char const* name)
|
||||
{
|
||||
time_point end = libtorrent::clock_type::now() + seconds(10);
|
||||
time_point end_time = libtorrent::clock_type::now() + seconds(10);
|
||||
while (true)
|
||||
{
|
||||
time_point now = clock_type::now();
|
||||
if (now > end) return NULL;
|
||||
if (now > end_time) return NULL;
|
||||
|
||||
alert const* ret = NULL;
|
||||
|
||||
ses.wait_for_alert(end - now);
|
||||
ses.wait_for_alert(end_time - now);
|
||||
std::vector<alert*> alerts;
|
||||
ses.pop_alerts(&alerts);
|
||||
for (std::vector<alert*>::iterator i = alerts.begin()
|
||||
, end(alerts.end()); i != end; ++i)
|
||||
for (auto a : alerts)
|
||||
{
|
||||
if (should_print(*i))
|
||||
if (should_print(a))
|
||||
{
|
||||
std::fprintf(stderr, "%s: %s: [%s] %s\n", time_now_string(), name
|
||||
, (*i)->what(), (*i)->message().c_str());
|
||||
, a->what(), a->message().c_str());
|
||||
}
|
||||
if ((*i)->type() == type && !ret)
|
||||
if (a->type() == type && !ret)
|
||||
{
|
||||
ret = *i;
|
||||
ret = a;
|
||||
}
|
||||
}
|
||||
if (ret) return ret;
|
||||
|
@ -294,22 +294,22 @@ bool print_alerts(lt::session& ses, char const* name
|
|||
if (!handles.empty()) h = handles[0];
|
||||
std::vector<alert*> alerts;
|
||||
ses.pop_alerts(&alerts);
|
||||
for (std::vector<alert*>::iterator i = alerts.begin(); i != alerts.end(); ++i)
|
||||
for (auto a : alerts)
|
||||
{
|
||||
if (predicate && predicate(*i)) ret = true;
|
||||
if (peer_disconnected_alert const* p = alert_cast<peer_disconnected_alert>(*i))
|
||||
if (predicate && predicate(a)) ret = true;
|
||||
if (peer_disconnected_alert const* p = alert_cast<peer_disconnected_alert>(a))
|
||||
{
|
||||
std::fprintf(stderr, "%s: %s: [%s] (%s): %s\n", time_now_string(), name, (*i)->what(), print_endpoint(p->ip).c_str(), p->message().c_str());
|
||||
std::fprintf(stderr, "%s: %s: [%s] (%s): %s\n", time_now_string(), name, (a)->what(), print_endpoint(p->ip).c_str(), p->message().c_str());
|
||||
}
|
||||
else if (should_print(*i)
|
||||
else if (should_print(a)
|
||||
&& !no_output)
|
||||
{
|
||||
std::fprintf(stderr, "%s: %s: [%s] %s\n", time_now_string(), name, (*i)->what(), (*i)->message().c_str());
|
||||
std::fprintf(stderr, "%s: %s: [%s] %s\n", time_now_string(), name, (a)->what(), (a)->message().c_str());
|
||||
}
|
||||
|
||||
TEST_CHECK(alert_cast<fastresume_rejected_alert>(*i) == 0 || allow_failed_fastresume);
|
||||
TEST_CHECK(alert_cast<fastresume_rejected_alert>(a) == 0 || allow_failed_fastresume);
|
||||
/*
|
||||
peer_error_alert const* pea = alert_cast<peer_error_alert>(*i);
|
||||
peer_error_alert const* pea = alert_cast<peer_error_alert>(a);
|
||||
if (pea)
|
||||
{
|
||||
std::fprintf(stderr, "%s: peer error: %s\n", time_now_string(), pea->error.message().c_str());
|
||||
|
@ -327,7 +327,7 @@ bool print_alerts(lt::session& ses, char const* name
|
|||
}
|
||||
*/
|
||||
|
||||
invalid_request_alert const* ira = alert_cast<invalid_request_alert>(*i);
|
||||
invalid_request_alert const* ira = alert_cast<invalid_request_alert>(a);
|
||||
if (ira)
|
||||
{
|
||||
std::fprintf(stderr, "peer error: %s\n", ira->message().c_str());
|
||||
|
@ -555,7 +555,8 @@ int start_proxy(int proxy_type)
|
|||
tcp::socket s(ios);
|
||||
s.open(tcp::v4(), ec);
|
||||
if (ec) break;
|
||||
s.bind(tcp::endpoint(address::from_string("127.0.0.1"), port), ec);
|
||||
s.bind(tcp::endpoint(address::from_string("127.0.0.1")
|
||||
, boost::uint16_t(port)), ec);
|
||||
} while (ec);
|
||||
|
||||
|
||||
|
@ -627,7 +628,6 @@ void create_random_files(std::string const& path, const int file_sizes[], int nu
|
|||
std::snprintf(dirname, sizeof(dirname), "test_dir%d", i / 5);
|
||||
|
||||
std::string full_path = combine_path(path, dirname);
|
||||
error_code ec;
|
||||
create_directory(full_path, ec);
|
||||
full_path = combine_path(full_path, filename);
|
||||
|
||||
|
@ -875,7 +875,7 @@ setup_transfer(lt::session* ses1, lt::session* ses2, lt::session* ses3
|
|||
std::fprintf(stderr, "%s: ses1: connecting peer port: %d\n"
|
||||
, time_now_string(), port);
|
||||
tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec)
|
||||
, port));
|
||||
, boost::uint16_t(port)));
|
||||
|
||||
if (ses3)
|
||||
{
|
||||
|
@ -897,11 +897,11 @@ setup_transfer(lt::session* ses1, lt::session* ses2, lt::session* ses3
|
|||
|
||||
std::fprintf(stderr, "ses3: connecting peer port: %d\n", port);
|
||||
tor3.connect_peer(tcp::endpoint(
|
||||
address::from_string("127.0.0.1", ec), port));
|
||||
address::from_string("127.0.0.1", ec), boost::uint16_t(port)));
|
||||
std::fprintf(stderr, "ses3: connecting peer port: %d\n", port2);
|
||||
tor3.connect_peer(tcp::endpoint(
|
||||
address::from_string("127.0.0.1", ec)
|
||||
, port2));
|
||||
, boost::uint16_t(port2)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -922,7 +922,8 @@ int start_web_server(bool ssl, bool chunked_encoding, bool keepalive)
|
|||
tcp::socket s(ios);
|
||||
s.open(tcp::v4(), ec);
|
||||
if (ec) break;
|
||||
s.bind(tcp::endpoint(address::from_string("127.0.0.1"), port), ec);
|
||||
s.bind(tcp::endpoint(address::from_string("127.0.0.1")
|
||||
, boost::uint16_t(port)), ec);
|
||||
} while (ec);
|
||||
|
||||
char buf[200];
|
||||
|
@ -951,7 +952,7 @@ void stop_web_server()
|
|||
tcp::endpoint ep(char const* ip, int port)
|
||||
{
|
||||
error_code ec;
|
||||
tcp::endpoint ret(address::from_string(ip, ec), port);
|
||||
tcp::endpoint ret(address::from_string(ip, ec), boost::uint16_t(port));
|
||||
TEST_CHECK(!ec);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,12 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "setup_transfer.hpp"
|
||||
#include "swarm_suite.hpp"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
// warning C4706: assignment within conditional expression
|
||||
#pragma warning( disable : 4706 )
|
||||
#endif
|
||||
|
||||
void test_swarm(int flags)
|
||||
{
|
||||
using namespace libtorrent;
|
||||
|
@ -236,4 +242,7 @@ void test_swarm(int flags)
|
|||
remove_all("tmp3_swarm", ec);
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -204,7 +204,8 @@ void run_suite(std::string const& protocol
|
|||
// only run the tests to handle NX_DOMAIN if we have a proper internet
|
||||
// connection that doesn't inject false DNS responses (like Comcast does)
|
||||
hostent* h = gethostbyname("non-existent-domain.se");
|
||||
std::printf("gethostbyname(\"non-existent-domain.se\") = %p. h_errno = %d\n", h, h_errno);
|
||||
std::printf("gethostbyname(\"non-existent-domain.se\") = %p. h_errno = %d\n"
|
||||
, static_cast<void*>(h), h_errno);
|
||||
if (h == 0 && h_errno == HOST_NOT_FOUND)
|
||||
{
|
||||
run_test(protocol + "://non-existent-domain.se/non-existing-file", -1, -1, 0, err(), ps);
|
||||
|
|
|
@ -76,7 +76,7 @@ static char const* proxy_name[] = {"", "_socks4", "_socks5", "_socks5_pw", "_htt
|
|||
|
||||
// proxy: 0=none, 1=socks4, 2=socks5, 3=socks5_pw 4=http 5=http_pw
|
||||
void test_transfer(lt::session& ses, boost::shared_ptr<torrent_info> torrent_file
|
||||
, int proxy, int port, char const* protocol, bool url_seed
|
||||
, int proxy, char const* protocol, bool url_seed
|
||||
, bool chunked_encoding, bool test_ban, bool keepalive, bool proxy_peers)
|
||||
{
|
||||
using namespace libtorrent;
|
||||
|
@ -259,7 +259,6 @@ void test_transfer(lt::session& ses, boost::shared_ptr<torrent_info> torrent_fil
|
|||
|
||||
if (!test_ban)
|
||||
{
|
||||
file_storage const& fs = torrent_file->files();
|
||||
for (int i = 0; i < fs.num_files(); ++i)
|
||||
{
|
||||
bool const expect = !fs.pad_file_at(i);
|
||||
|
@ -409,13 +408,13 @@ int EXPORT run_http_suite(int proxy, char const* protocol, bool test_url_seed
|
|||
pack.set_bool(settings_pack::enable_dht, false);
|
||||
libtorrent::session ses(pack, 0);
|
||||
|
||||
test_transfer(ses, torrent_file, proxy, port, protocol, test_url_seed
|
||||
test_transfer(ses, torrent_file, proxy, protocol, test_url_seed
|
||||
, chunked_encoding, test_ban, keepalive, proxy_peers);
|
||||
|
||||
if (test_url_seed && test_rename)
|
||||
{
|
||||
torrent_file->rename_file(0, combine_path(save_path, combine_path("torrent_dir", "renamed_test1")));
|
||||
test_transfer(ses, torrent_file, 0, port, protocol, test_url_seed
|
||||
test_transfer(ses, torrent_file, 0, protocol, test_url_seed
|
||||
, chunked_encoding, test_ban, keepalive, proxy_peers);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ int EXPORT run_http_suite(int proxy, char const* protocol
|
|||
|
||||
void EXPORT test_transfer(libtorrent::session& ses
|
||||
, boost::shared_ptr<libtorrent::torrent_info> torrent_file
|
||||
, int proxy = 0, int port = 0, char const* protocol = "http"
|
||||
, int proxy = 0, char const* protocol = "http"
|
||||
, bool url_seed = true, bool chunked_encoding = false
|
||||
, bool test_ban = false, bool keepalive = true, bool proxy_peers = true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue