merge RC_1_1 into master

This commit is contained in:
arvidn 2018-09-24 21:15:12 -07:00
commit 109db58641
24 changed files with 53 additions and 127 deletions

View File

@ -88,6 +88,9 @@
* resume data no longer has timestamps of files
* require C++11 to build libtorrent
* split progress_notification alert category into file-, piece- and block progress
* utp close-reason fix
* exposed default add_torrent_params flags to python bindings
* fix redundant flushes of partfile metadata
* add option to ignore min-interval from trackers on force-reannounce
* raise default setting for active_limit

View File

@ -836,6 +836,7 @@ void bind_session()
s.attr("stop_when_ready") = torrent_flags::stop_when_ready;
s.attr("override_trackers") = torrent_flags::override_trackers;
s.attr("override_web_seeds") = torrent_flags::override_web_seeds;
s.attr("default_flags") = torrent_flags::default_flags;
}
#if TORRENT_ABI_VERSION == 1
@ -859,6 +860,7 @@ void bind_session()
s.attr("flag_merge_resume_trackers") = add_torrent_params::flag_merge_resume_trackers;
s.attr("flag_use_resume_save_path") = add_torrent_params::flag_use_resume_save_path;
s.attr("flag_merge_resume_http_seeds") = add_torrent_params::flag_merge_resume_http_seeds;
s.attr("default_flags") = add_torrent_params::flag_default_flags;
}
#endif

View File

@ -70,7 +70,8 @@ class test_torrent_handle(unittest.TestCase):
self.ses = lt.session(settings)
self.ti = lt.torrent_info('url_seed_multi.torrent')
self.h = self.ses.add_torrent({
'ti': self.ti, 'save_path': os.getcwd()})
'ti': self.ti, 'save_path': os.getcwd(),
'flags': lt.torrent_flags.default_flags})
def test_torrent_handle(self):
self.setup()
@ -536,7 +537,8 @@ class test_session(unittest.TestCase):
self.assertEqual(s.get_settings()['user_agent'], 'test123')
def test_post_session_stats(self):
s = lt.session({'alert_mask': lt.alert.category_t.stats_notification, 'enable_dht': False})
s = lt.session({'alert_mask': lt.alert.category_t.stats_notification,
'enable_dht': False})
s.post_session_stats()
alerts = []
# first the stats headers log line. but not if logging is disabled

View File

@ -1447,7 +1447,7 @@ void utp_socket_impl::parse_close_reason(std::uint8_t const* ptr, int const size
UTP_LOGV("%8p: incoming close_reason: %d\n"
, static_cast<void*>(this), int(incoming_close_reason));
if (m_userdata == nullptr) return;
if (m_userdata == nullptr || !m_attached) return;
utp_stream::on_close_reason(m_userdata, incoming_close_reason);
}

View File

@ -38,14 +38,25 @@ using namespace lt;
lt::settings_pack settings()
{
auto const mask = alert::all_categories
& ~(
alert::performance_warning
#if TORRENT_ABI_VERSION == 1
| alert::progress_notification
#endif
| alert::stats_notification
| alert::picker_log_notification);
alert_category_t const mask =
alert::error_notification
| alert::peer_notification
| alert::port_mapping_notification
| alert::storage_notification
| alert::tracker_notification
| alert::debug_notification
| alert::status_notification
| alert::ip_block_notification
| alert::dht_notification
| alert::session_log_notification
| alert::torrent_log_notification
| alert::peer_log_notification
| alert::incoming_request_notification
| alert::dht_log_notification
| alert::dht_operation_notification
| alert::port_mapping_log_notification
| alert::file_progress_notification
| alert::piece_progress_notification;
settings_pack pack;
pack.set_bool(settings_pack::enable_lsd, false);

View File

@ -794,16 +794,7 @@ setup_transfer(lt::session* ses1, lt::session* ses2, lt::session* ses3
ses2->set_peer_class_filter(f);
if (ses3) ses3->set_peer_class_filter(f);
auto const mask = alert::all_categories
& ~(
alert::performance_warning
#if TORRENT_ABI_VERSION == 1
| alert::progress_notification
#endif
| alert::stats_notification);
settings_pack pack;
pack.set_int(settings_pack::alert_mask, mask);
if (ses3) pack.set_bool(settings_pack::allow_multiple_connections_per_ip, true);
pack.set_int(settings_pack::mixed_mode_algorithm, settings_pack::prefer_tcp);
pack.set_int(settings_pack::max_failcount, 1);

View File

@ -42,6 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "setup_transfer.hpp"
#include "settings.hpp"
#include "swarm_suite.hpp"
#ifdef _MSC_VER
@ -75,19 +76,7 @@ void test_swarm(test_flags_t const flags)
session_proxy p2;
session_proxy p3;
auto const mask = ~(
alert::performance_warning
#if TORRENT_ABI_VERSION == 1
| alert::progress_notification
#endif
| alert::stats_notification);
settings_pack pack;
pack.set_bool(settings_pack::enable_lsd, false);
pack.set_bool(settings_pack::enable_natpmp, false);
pack.set_bool(settings_pack::enable_upnp, false);
pack.set_bool(settings_pack::enable_dht, false);
pack.set_int(settings_pack::alert_mask, mask);
settings_pack pack = settings();
pack.set_bool(settings_pack::allow_multiple_connections_per_ip, true);
if (flags & test_flags::strict_super_seeding)

View File

@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "setup_transfer.hpp"
#include "settings.hpp"
namespace {
@ -60,12 +61,11 @@ void test_swarm()
// three peers before finishing.
float rate_limit = 50000;
settings_pack pack;
settings_pack pack = settings();
// run the choker once per second, to make it more likely to actually trigger
// during the test.
pack.set_int(settings_pack::unchoke_interval, 1);
pack.set_int(settings_pack::alert_mask, alert::all_categories);
pack.set_bool(settings_pack::allow_multiple_connections_per_ip, true);
pack.set_int(settings_pack::choking_algorithm, settings_pack::rate_based_choker);
pack.set_int(settings_pack::upload_rate_limit, int(rate_limit));

View File

@ -32,6 +32,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "setup_transfer.hpp"
#include "settings.hpp"
#include "test_utils.hpp"
#include "libtorrent/socket.hpp"
@ -420,9 +421,8 @@ std::shared_ptr<torrent_info> setup_peer(tcp::socket& s, sha1_hash& ih
{
std::shared_ptr<torrent_info> t = ::create_torrent();
ih = t->info_hash();
settings_pack sett;
settings_pack sett = settings();
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48900");
sett.set_int(settings_pack::alert_mask, alert::all_categories);
sett.set_bool(settings_pack::enable_upnp, false);
sett.set_bool(settings_pack::enable_natpmp, false);
sett.set_bool(settings_pack::enable_lsd, false);

View File

@ -44,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <tuple>
#include "setup_transfer.hpp"
#include "settings.hpp"
#include <iostream>
namespace {
@ -59,18 +60,10 @@ void test_pex()
session_proxy p2;
session_proxy p3;
auto const mask = ~(
alert::performance_warning
#if TORRENT_ABI_VERSION == 1
| alert::progress_notification
#endif
| alert::stats_notification);
// this is to avoid everything finish from a single peer
// immediately. To make the swarm actually connect all
// three peers before finishing.
settings_pack pack;
pack.set_int(settings_pack::alert_mask, mask);
settings_pack pack = settings();
pack.set_int(settings_pack::download_rate_limit, 2000);
pack.set_int(settings_pack::upload_rate_limit, 2000);
pack.set_int(settings_pack::max_retry_port_bind, 800);

View File

@ -54,8 +54,6 @@ using std::ignore;
namespace {
alert_category_t const mask = alert::all_categories & ~(alert::performance_warning | alert::stats_notification);
int peer_disconnects = 0;
bool on_alert(alert const* a)
@ -95,7 +93,6 @@ void test_transfer(settings_pack const& sett, bool test_deprecated = false)
pack.set_bool(settings_pack::enable_outgoing_utp, false);
pack.set_bool(settings_pack::enable_incoming_utp, false);
pack.set_int(settings_pack::alert_mask, mask);
pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_disabled);
pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_disabled);
@ -108,7 +105,6 @@ void test_transfer(settings_pack const& sett, bool test_deprecated = false)
pack.set_bool(settings_pack::enable_dht, false);
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075");
pack.set_int(settings_pack::alert_mask, mask);
#if TORRENT_ABI_VERSION == 1
pack.set_bool(settings_pack::rate_limit_utp, true);
#endif
@ -116,7 +112,6 @@ void test_transfer(settings_pack const& sett, bool test_deprecated = false)
lt::session ses1(pack);
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:49075");
pack.set_int(settings_pack::alert_mask, mask);
lt::session ses2(pack);
torrent_handle tor1;
@ -403,7 +398,7 @@ TORRENT_TEST(priority)
TORRENT_TEST(priority_deprecated)
{
using namespace lt;
settings_pack p;
settings_pack p = settings();
test_transfer(p, true);
cleanup();
}

View File

@ -87,20 +87,12 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, flags_t flags)
int const prev_udp_announces = num_udp_announces();
auto const alert_mask = ~(
alert::performance_warning
#if TORRENT_ABI_VERSION == 1
| alert::progress_notification
#endif
| alert::stats_notification);
settings_pack sett = settings();
sett.set_int(settings_pack::stop_tracker_timeout, 2);
sett.set_int(settings_pack::tracker_completion_timeout, 2);
sett.set_int(settings_pack::tracker_receive_timeout, 2);
sett.set_bool(settings_pack::announce_to_all_trackers, true);
sett.set_bool(settings_pack::announce_to_all_tiers, true);
sett.set_int(settings_pack::alert_mask, alert_mask);
sett.set_bool(settings_pack::enable_upnp, false);
sett.set_bool(settings_pack::enable_natpmp, false);
sett.set_bool(settings_pack::enable_lsd, false);

View File

@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/session.hpp"
#include "test.hpp"
#include "setup_transfer.hpp"
#include "settings.hpp"
#include "libtorrent/create_torrent.hpp"
#include "libtorrent/alert_types.hpp"
#include "libtorrent/torrent_info.hpp"
@ -90,21 +91,8 @@ void test_read_piece(int flags)
std::printf("generated torrent: %s tmp1_read_piece/test_torrent\n"
, aux::to_hex(ti->info_hash()).c_str());
auto const mask = ~(
alert::performance_warning
#if TORRENT_ABI_VERSION == 1
| alert::progress_notification
#endif
| alert::stats_notification);
settings_pack sett;
sett.set_bool(settings_pack::enable_lsd, false);
sett.set_bool(settings_pack::enable_natpmp, false);
sett.set_bool(settings_pack::enable_upnp, false);
sett.set_bool(settings_pack::enable_dht, false);
sett.set_int(settings_pack::alert_mask, mask);
settings_pack sett = settings();
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48000");
sett.set_int(settings_pack::alert_mask, alert::all_categories);
lt::session ses(sett);
add_torrent_params p;

View File

@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "setup_transfer.hpp"
#include "settings.hpp"
#include <fstream>
#include <iostream>
@ -51,8 +52,6 @@ using namespace lt;
namespace {
auto const mask = alert::all_categories & ~(alert::performance_warning | alert::stats_notification);
void wait_for_complete(lt::session& ses, torrent_handle h)
{
int last_progress = 0;
@ -81,9 +80,8 @@ void wait_for_complete(lt::session& ses, torrent_handle h)
TORRENT_TEST(recheck)
{
error_code ec;
settings_pack sett;
settings_pack sett = settings();
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48675");
sett.set_int(settings_pack::alert_mask, mask);
sett.set_bool(settings_pack::enable_upnp, false);
sett.set_bool(settings_pack::enable_natpmp, false);
sett.set_bool(settings_pack::enable_lsd, false);

View File

@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/torrent_info.hpp"
#include "libtorrent/aux_/path.hpp"
#include "setup_transfer.hpp"
#include "settings.hpp"
#include "test.hpp"
#include "settings.hpp"

BIN
test/test_settings_pack Executable file

Binary file not shown.

View File

@ -42,6 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "test_utils.hpp"
#include "setup_transfer.hpp"
#include "settings.hpp"
#include "libtorrent/aux_/disable_warnings_push.hpp"
@ -63,10 +64,6 @@ using std::ignore;
namespace {
auto const alert_mask = alert::all_categories
& ~alert::progress_notification
& ~alert::stats_notification;
struct test_config_t
{
char const* name;
@ -144,8 +141,7 @@ void test_ssl(int const test_idx, bool const use_utp)
remove_all("tmp2_ssl", ec);
int port = 1024 + rand() % 50000;
settings_pack sett;
sett.set_int(settings_pack::alert_mask, alert_mask);
settings_pack sett = settings();
sett.set_int(settings_pack::max_retry_port_bind, 100);
char listen_iface[100];
@ -553,8 +549,7 @@ void test_malicious_peer()
// set up session
int port = 1024 + rand() % 50000;
settings_pack sett;
sett.set_int(settings_pack::alert_mask, alert_mask);
settings_pack sett = settings();
sett.set_int(settings_pack::max_retry_port_bind, 100);
char listen_iface[100];

View File

@ -800,12 +800,7 @@ TORRENT_TEST(rename_file)
file_storage fs;
std::shared_ptr<torrent_info> info = setup_torrent_info(fs, buf);
auto const mask = alert::all_categories
& ~(alert::performance_warning
| alert::stats_notification);
settings_pack pack = settings();
pack.set_int(settings_pack::alert_mask, mask);
pack.set_bool(settings_pack::disable_hash_checks, true);
lt::session ses(pack);

View File

@ -78,7 +78,7 @@ bool prioritize_files(torrent_handle const& h, aux::vector<download_priority_t,
void test_running_torrent(std::shared_ptr<torrent_info> info, std::int64_t file_size)
{
settings_pack pack = settings();
pack.set_int(settings_pack::alert_mask, alert::file_progress_notification | alert::storage_notification);
pack.set_int(settings_pack::alert_mask, alert::piece_progress_notification | alert::storage_notification);
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:48130");
pack.set_int(settings_pack::max_retry_port_bind, 10);
lt::session ses(pack);

View File

@ -506,7 +506,6 @@ TORRENT_TEST(current_tracker)
pack.set_int(settings_pack::tracker_completion_timeout, 2);
pack.set_int(settings_pack::tracker_receive_timeout, 1);
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:39775");
//pack.set_int(settings_pack::alert_mask, alert::tracker_notification);
std::unique_ptr<lt::session> s(new lt::session(pack));
@ -665,7 +664,6 @@ void test_stop_tracker_timeout(int const timeout)
settings_pack p = settings();
p.set_bool(settings_pack::announce_to_all_trackers, true);
p.set_bool(settings_pack::announce_to_all_tiers, true);
p.set_int(settings_pack::alert_mask, alert::all_categories);
p.set_str(settings_pack::listen_interfaces, "0.0.0.0:6881");
p.set_int(settings_pack::stop_tracker_timeout, timeout);

View File

@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "setup_transfer.hpp"
#include "settings.hpp"
#include "test_utils.hpp"
#include <tuple>
@ -55,9 +56,6 @@ using std::ignore;
namespace {
auto const mask = alert::all_categories
& ~(alert::performance_warning | alert::stats_notification);
int peer_disconnects = 0;
bool on_alert(alert const* a)
@ -154,9 +152,8 @@ void test_transfer(int proxy_type, settings_pack const& sett
session_proxy p1;
session_proxy p2;
settings_pack pack;
settings_pack pack = settings();
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075");
pack.set_int(settings_pack::alert_mask, mask);
pack.set_bool(settings_pack::enable_upnp, false);
pack.set_bool(settings_pack::enable_natpmp, false);
@ -212,7 +209,6 @@ void test_transfer(int proxy_type, settings_pack const& sett
pack.set_bool(settings_pack::enable_natpmp, false);
pack.set_bool(settings_pack::enable_upnp, false);
pack.set_bool(settings_pack::enable_dht, false);
pack.set_int(settings_pack::alert_mask, mask);
pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_disabled);
pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_disabled);

View File

@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "setup_transfer.hpp"
#include "settings.hpp"
#include <fstream>
using namespace lt;
@ -62,19 +63,11 @@ void test_transfer()
session_proxy p1;
session_proxy p2;
auto const mask = ~(
alert::performance_warning
#if TORRENT_ABI_VERSION == 1
| alert::progress_notification
#endif
| alert::stats_notification);
settings_pack pack;
settings_pack pack = settings();
pack.set_bool(settings_pack::enable_lsd, false);
pack.set_bool(settings_pack::enable_natpmp, false);
pack.set_bool(settings_pack::enable_upnp, false);
pack.set_bool(settings_pack::enable_dht, false);
pack.set_int(settings_pack::alert_mask, mask);
pack.set_int(settings_pack::out_enc_policy, settings_pack::pe_disabled);
pack.set_int(settings_pack::in_enc_policy, settings_pack::pe_disabled);
pack.set_bool(settings_pack::enable_outgoing_tcp, false);

View File

@ -88,16 +88,8 @@ TORRENT_TEST(web_seed_redirect)
auto torrent_file = std::make_shared<torrent_info>(buf, ec, from_span);
{
auto const mask = ~(
alert::performance_warning
#if TORRENT_ABI_VERSION == 1
| alert::progress_notification
#endif
| alert::stats_notification);
settings_pack p = settings();
p.set_int(settings_pack::max_queued_disk_bytes, 256 * 1024);
p.set_int(settings_pack::alert_mask, mask);
lt::session ses(p);
// disable keep-alive because otherwise the test will choke on seeing

View File

@ -44,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "test.hpp"
#include "setup_transfer.hpp"
#include "settings.hpp"
#include "web_seed_suite.hpp"
#include "make_torrent.hpp"
@ -391,19 +392,10 @@ int EXPORT run_http_suite(int proxy, char const* protocol, bool test_url_seed
}
{
auto const mask = alert::all_categories
& ~(
alert::performance_warning
#if TORRENT_ABI_VERSION == 1
| alert::progress_notification
#endif
| alert::stats_notification);
settings_pack pack;
settings_pack pack = settings();
pack.set_int(settings_pack::max_queued_disk_bytes, 256 * 1024);
pack.set_str(settings_pack::listen_interfaces, "0.0.0.0:51000");
pack.set_int(settings_pack::max_retry_port_bind, 1000);
pack.set_int(settings_pack::alert_mask, mask);
pack.set_bool(settings_pack::enable_lsd, false);
pack.set_bool(settings_pack::enable_natpmp, false);
pack.set_bool(settings_pack::enable_upnp, false);