forked from premiere/premiere-libtorrent
back-port the patch to split up the progress_notification alert_mask into three new categories, file-, piece- and block progress
This commit is contained in:
parent
022a089b86
commit
6c4d1b9143
|
@ -1,3 +1,4 @@
|
|||
* 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
|
||||
|
|
|
@ -226,6 +226,9 @@ void bind_alert()
|
|||
.value("dht_operation_notification", alert::dht_operation_notification)
|
||||
.value("port_mapping_log_notification", alert::port_mapping_log_notification)
|
||||
.value("picker_log_notification", alert::picker_log_notification)
|
||||
.value("file_progress_notification", alert::file_progress_notification)
|
||||
.value("piece_progress_notification", alert::piece_progress_notification)
|
||||
.value("block_progress_notification", alert::block_progress_notification)
|
||||
// deliberately not INT_MAX. Arch linux crash while throwing an exception
|
||||
.value("all_categories", (alert::category_t)0xfffffff)
|
||||
;
|
||||
|
|
|
@ -1539,6 +1539,8 @@ int main(int argc, char* argv[])
|
|||
settings.set_str(settings_pack::user_agent, "client_test/" LIBTORRENT_VERSION);
|
||||
settings.set_int(settings_pack::alert_mask, alert::all_categories
|
||||
& ~(alert::dht_notification
|
||||
+ alert::piece_progress_notification
|
||||
+ alert::block_progress_notification
|
||||
+ alert::progress_notification
|
||||
+ alert::stats_notification
|
||||
+ alert::session_log_notification
|
||||
|
|
|
@ -79,17 +79,25 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
namespace libtorrent {
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
// The ``alert`` class is the base class that specific messages are derived from.
|
||||
// alert types are not copyable, and cannot be constructed by the client. The
|
||||
// pointers returned by libtorrent are short lived (the details are described
|
||||
// under session_handle::pop_alerts())
|
||||
class TORRENT_EXPORT alert
|
||||
{
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
public:
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// only here for backwards compatibility
|
||||
enum TORRENT_DEPRECATED severity_t { debug, info, warning, critical, fatal, none };
|
||||
enum TORRENT_DEPRECATED_ENUM severity_t { debug, info, warning, critical, fatal, none };
|
||||
#endif
|
||||
|
||||
// these are bits for the alert_mask used by the session. See
|
||||
|
@ -190,6 +198,17 @@ namespace libtorrent {
|
|||
// enables verbose logging from the piece picker.
|
||||
picker_log_notification = 0x100000,
|
||||
|
||||
// alerts when files complete downloading
|
||||
file_progress_notification = 0x200000,
|
||||
|
||||
// alerts when pieces complete downloading or fail hash check
|
||||
piece_progress_notification = 0x400000,
|
||||
|
||||
// alerts on individual blocks being requested, downloading, finished,
|
||||
// rejected, time-out and cancelled. This is likely to post alerts at a
|
||||
// high rate.
|
||||
block_progress_notification = 0x800000,
|
||||
|
||||
// The full bitmask, representing all available categories.
|
||||
//
|
||||
// since the enum is signed, make sure this isn't
|
||||
|
|
|
@ -280,7 +280,10 @@ namespace libtorrent
|
|||
|
||||
TORRENT_DEFINE_ALERT_PRIO(file_completed_alert, 6, alert_priority_normal)
|
||||
|
||||
static const int static_category = alert::progress_notification;
|
||||
static const int static_category =
|
||||
alert::file_progress_notification
|
||||
| alert::progress_notification
|
||||
;
|
||||
virtual std::string message() const TORRENT_OVERRIDE;
|
||||
|
||||
// refers to the index of the file that completed.
|
||||
|
@ -823,7 +826,10 @@ namespace libtorrent
|
|||
|
||||
TORRENT_DEFINE_ALERT(piece_finished_alert, 27)
|
||||
|
||||
static const int static_category = alert::progress_notification;
|
||||
static const int static_category =
|
||||
alert::piece_progress_notification
|
||||
| alert::progress_notification
|
||||
;
|
||||
virtual std::string message() const TORRENT_OVERRIDE;
|
||||
|
||||
// the index of the piece that finished
|
||||
|
@ -840,8 +846,11 @@ namespace libtorrent
|
|||
|
||||
TORRENT_DEFINE_ALERT(request_dropped_alert, 28)
|
||||
|
||||
static const int static_category = alert::progress_notification
|
||||
| alert::peer_notification;
|
||||
static const int static_category =
|
||||
alert::block_progress_notification
|
||||
| alert::peer_notification
|
||||
| alert::progress_notification
|
||||
;
|
||||
virtual std::string message() const TORRENT_OVERRIDE;
|
||||
|
||||
int block_index;
|
||||
|
@ -858,8 +867,11 @@ namespace libtorrent
|
|||
|
||||
TORRENT_DEFINE_ALERT(block_timeout_alert, 29)
|
||||
|
||||
static const int static_category = alert::progress_notification
|
||||
| alert::peer_notification;
|
||||
static const int static_category =
|
||||
alert::block_progress_notification
|
||||
| alert::peer_notification
|
||||
| alert::progress_notification
|
||||
;
|
||||
virtual std::string message() const TORRENT_OVERRIDE;
|
||||
|
||||
int block_index;
|
||||
|
@ -876,7 +888,10 @@ namespace libtorrent
|
|||
|
||||
TORRENT_DEFINE_ALERT(block_finished_alert, 30)
|
||||
|
||||
static const int static_category = alert::progress_notification;
|
||||
static const int static_category =
|
||||
alert::block_progress_notification
|
||||
| alert::progress_notification
|
||||
;
|
||||
virtual std::string message() const TORRENT_OVERRIDE;
|
||||
|
||||
int block_index;
|
||||
|
@ -893,7 +908,10 @@ namespace libtorrent
|
|||
|
||||
TORRENT_DEFINE_ALERT(block_downloading_alert, 31)
|
||||
|
||||
static const int static_category = alert::progress_notification;
|
||||
static const int static_category =
|
||||
alert::block_progress_notification
|
||||
| alert::progress_notification
|
||||
;
|
||||
virtual std::string message() const TORRENT_OVERRIDE;
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
|
|
|
@ -445,7 +445,7 @@ TORRENT_TEST(torrent_completed_alert)
|
|||
// add session
|
||||
, [](lt::settings_pack& pack)
|
||||
{
|
||||
pack.set_int(lt::settings_pack::alert_mask, alert::progress_notification);
|
||||
pack.set_int(lt::settings_pack::alert_mask, alert::file_progress_notification);
|
||||
}
|
||||
// add torrent
|
||||
, [](lt::add_torrent_params&) {}
|
||||
|
|
|
@ -38,11 +38,25 @@ using namespace libtorrent;
|
|||
|
||||
libtorrent::settings_pack settings()
|
||||
{
|
||||
const int mask = alert::all_categories
|
||||
& ~(alert::progress_notification
|
||||
| alert::performance_warning
|
||||
| alert::stats_notification
|
||||
| alert::picker_log_notification);
|
||||
const int 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);
|
||||
|
|
|
@ -744,8 +744,15 @@ 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);
|
||||
|
||||
const int mask = alert::all_categories
|
||||
& ~(alert::progress_notification
|
||||
| alert::piece_progress_notification
|
||||
| alert::block_progress_notification
|
||||
| alert::performance_warning
|
||||
| alert::stats_notification
|
||||
| alert::picker_log_notification);
|
||||
settings_pack pack;
|
||||
pack.set_int(settings_pack::alert_mask, ~(alert::progress_notification | alert::stats_notification));
|
||||
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);
|
||||
|
|
|
@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
#include "settings.hpp"
|
||||
#include "swarm_suite.hpp"
|
||||
|
||||
void test_swarm(int flags)
|
||||
|
@ -69,17 +70,11 @@ void test_swarm(int flags)
|
|||
session_proxy p2;
|
||||
session_proxy p3;
|
||||
|
||||
const int mask = alert::all_categories
|
||||
& ~(alert::progress_notification
|
||||
| alert::performance_warning
|
||||
| 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_bool(settings_pack::allow_multiple_connections_per_ip, true);
|
||||
|
||||
if (flags & strict_super_seeding)
|
||||
|
|
|
@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
#include "settings.hpp"
|
||||
|
||||
void test_swarm()
|
||||
{
|
||||
|
@ -59,12 +60,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, rate_limit);
|
||||
|
|
|
@ -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"
|
||||
|
@ -413,9 +414,8 @@ boost::shared_ptr<torrent_info> setup_peer(tcp::socket& s, sha1_hash& ih
|
|||
{
|
||||
boost::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);
|
||||
|
|
|
@ -44,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#include "setup_transfer.hpp"
|
||||
#include "settings.hpp"
|
||||
#include <iostream>
|
||||
|
||||
void test_pex()
|
||||
|
@ -58,16 +59,10 @@ void test_pex()
|
|||
session_proxy p2;
|
||||
session_proxy p3;
|
||||
|
||||
int mask = alert::all_categories
|
||||
& ~(alert::progress_notification
|
||||
| alert::performance_warning
|
||||
| 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);
|
||||
|
|
|
@ -51,8 +51,6 @@ using namespace libtorrent;
|
|||
namespace lt = libtorrent;
|
||||
using boost::tuples::ignore;
|
||||
|
||||
const int mask = alert::all_categories & ~(alert::performance_warning | alert::stats_notification);
|
||||
|
||||
int peer_disconnects = 0;
|
||||
|
||||
bool on_alert(alert const* a)
|
||||
|
@ -92,7 +90,6 @@ void test_transfer(settings_pack const& sett)
|
|||
|
||||
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);
|
||||
|
@ -105,7 +102,6 @@ void test_transfer(settings_pack const& sett)
|
|||
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);
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
pack.set_bool(settings_pack::rate_limit_utp, true);
|
||||
#endif
|
||||
|
@ -113,7 +109,6 @@ void test_transfer(settings_pack const& sett)
|
|||
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;
|
||||
|
|
|
@ -98,10 +98,6 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags)
|
|||
|
||||
int const prev_udp_announces = num_udp_announces();
|
||||
|
||||
int const alert_mask = alert::all_categories
|
||||
& ~alert::progress_notification
|
||||
& ~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);
|
||||
|
@ -109,7 +105,6 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags)
|
|||
sett.set_bool(settings_pack::announce_to_all_trackers, true);
|
||||
sett.set_bool(settings_pack::announce_to_all_tiers, true);
|
||||
sett.set_bool(settings_pack::force_proxy, flags & force_proxy_mode);
|
||||
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);
|
||||
|
|
|
@ -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"
|
||||
|
@ -88,19 +89,12 @@ void test_read_piece(int flags)
|
|||
fprintf(stderr, "generated torrent: %s tmp1_read_piece/test_torrent\n"
|
||||
, to_hex(ti->info_hash().to_string()).c_str());
|
||||
|
||||
const int mask = alert::all_categories
|
||||
& ~(alert::progress_notification
|
||||
| alert::performance_warning
|
||||
| alert::stats_notification);
|
||||
|
||||
settings_pack sett;
|
||||
settings_pack sett = settings();
|
||||
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);
|
||||
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;
|
||||
|
|
|
@ -44,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
#include "settings.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
@ -51,8 +52,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
using namespace libtorrent;
|
||||
namespace lt = libtorrent;
|
||||
|
||||
const int mask = alert::all_categories & ~(alert::performance_warning | alert::stats_notification);
|
||||
|
||||
void wait_for_complete(lt::session& ses, torrent_handle h)
|
||||
{
|
||||
int last_progress = 0;
|
||||
|
@ -77,9 +76,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);
|
||||
|
|
|
@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/create_torrent.hpp"
|
||||
#include "libtorrent/torrent_info.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
#include "settings.hpp"
|
||||
#include "test.hpp"
|
||||
|
||||
#include <fstream>
|
||||
|
@ -69,20 +70,15 @@ void test_remap_files_gather(storage_mode_t storage_mode = storage_mode_sparse)
|
|||
// in case the previous run was terminated
|
||||
error_code ec;
|
||||
|
||||
int const alert_mask = alert::all_categories
|
||||
& ~alert::progress_notification
|
||||
& ~alert::stats_notification;
|
||||
|
||||
session_proxy p1;
|
||||
session_proxy p2;
|
||||
|
||||
settings_pack sett;
|
||||
settings_pack sett = settings();
|
||||
sett.set_bool(settings_pack::enable_upnp, false);
|
||||
sett.set_bool(settings_pack::enable_natpmp, false);
|
||||
sett.set_bool(settings_pack::enable_lsd, false);
|
||||
sett.set_bool(settings_pack::enable_dht, false);
|
||||
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075");
|
||||
sett.set_int(settings_pack::alert_mask, alert_mask);
|
||||
|
||||
lt::session ses1(sett);
|
||||
|
||||
|
@ -231,25 +227,19 @@ void test_remap_files_scatter(storage_mode_t storage_mode = storage_mode_sparse)
|
|||
// in case the previous run was terminated
|
||||
error_code ec;
|
||||
|
||||
int const alert_mask = alert::all_categories
|
||||
& ~alert::progress_notification
|
||||
& ~alert::stats_notification;
|
||||
|
||||
session_proxy p1;
|
||||
session_proxy p2;
|
||||
|
||||
settings_pack sett;
|
||||
settings_pack sett = settings();
|
||||
sett.set_bool(settings_pack::enable_upnp, false);
|
||||
sett.set_bool(settings_pack::enable_natpmp, false);
|
||||
sett.set_bool(settings_pack::enable_lsd, false);
|
||||
sett.set_bool(settings_pack::enable_dht, false);
|
||||
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075");
|
||||
sett.set_int(settings_pack::alert_mask, alert_mask);
|
||||
|
||||
lt::session ses1(sett);
|
||||
|
||||
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:49075");
|
||||
sett.set_int(settings_pack::alert_mask, alert_mask);
|
||||
lt::session ses2(sett);
|
||||
|
||||
torrent_handle tor1;
|
||||
|
@ -374,20 +364,15 @@ void test_remap_files_prio(storage_mode_t storage_mode = storage_mode_sparse)
|
|||
// in case the previous run was terminated
|
||||
error_code ec;
|
||||
|
||||
int const alert_mask = alert::all_categories
|
||||
& ~alert::progress_notification
|
||||
& ~alert::stats_notification;
|
||||
|
||||
session_proxy p1;
|
||||
session_proxy p2;
|
||||
|
||||
settings_pack sett;
|
||||
settings_pack sett = settings();
|
||||
sett.set_bool(settings_pack::enable_upnp, false);
|
||||
sett.set_bool(settings_pack::enable_natpmp, false);
|
||||
sett.set_bool(settings_pack::enable_lsd, false);
|
||||
sett.set_bool(settings_pack::enable_dht, false);
|
||||
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075");
|
||||
sett.set_int(settings_pack::alert_mask, alert_mask);
|
||||
lt::session ses1(sett);
|
||||
|
||||
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:49075");
|
||||
|
|
|
@ -40,6 +40,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"
|
||||
|
||||
|
@ -58,10 +59,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
using namespace libtorrent;
|
||||
using boost::tuples::ignore;
|
||||
|
||||
int const alert_mask = alert::all_categories
|
||||
& ~alert::progress_notification
|
||||
& ~alert::stats_notification;
|
||||
|
||||
struct test_config_t
|
||||
{
|
||||
char const* name;
|
||||
|
@ -132,8 +129,7 @@ void test_ssl(int const test_idx, bool const use_utp)
|
|||
remove_all("tmp2_ssl", ec);
|
||||
|
||||
int ssl_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);
|
||||
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075");
|
||||
sett.set_bool(settings_pack::enable_incoming_utp, use_utp);
|
||||
|
@ -544,8 +540,7 @@ void test_malicious_peer()
|
|||
|
||||
// set up session
|
||||
int ssl_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);
|
||||
sett.set_str(settings_pack::listen_interfaces, "0.0.0.0:48075");
|
||||
sett.set_int(settings_pack::ssl_listen, ssl_port);
|
||||
|
|
|
@ -659,17 +659,11 @@ TORRENT_TEST(fastresume)
|
|||
|
||||
entry resume;
|
||||
{
|
||||
const int mask = alert::all_categories
|
||||
& ~(alert::progress_notification
|
||||
| alert::performance_warning
|
||||
| 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);
|
||||
lt::session ses(pack);
|
||||
|
||||
error_code ec;
|
||||
|
@ -720,17 +714,11 @@ TORRENT_TEST(fastresume)
|
|||
|
||||
// make sure the fast resume check fails! since we removed the file
|
||||
{
|
||||
const int mask = alert::all_categories
|
||||
& ~(alert::progress_notification
|
||||
| alert::performance_warning
|
||||
| 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);
|
||||
lt::session ses(pack);
|
||||
|
||||
add_torrent_params p;
|
||||
|
@ -765,12 +753,7 @@ TORRENT_TEST(rename_file)
|
|||
file_storage fs;
|
||||
boost::shared_ptr<torrent_info> info = setup_torrent_info(fs, buf);
|
||||
|
||||
const int 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);
|
||||
|
||||
|
@ -835,17 +818,11 @@ TORRENT_TEST(rename_file_fastresume)
|
|||
|
||||
entry resume;
|
||||
{
|
||||
const int mask = alert::all_categories
|
||||
& ~(alert::progress_notification
|
||||
| alert::performance_warning
|
||||
| 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);
|
||||
lt::session ses(pack);
|
||||
|
||||
add_torrent_params p;
|
||||
|
@ -883,17 +860,11 @@ TORRENT_TEST(rename_file_fastresume)
|
|||
|
||||
// make sure the fast resume check succeeds, even though we renamed the file
|
||||
{
|
||||
const int mask = alert::all_categories
|
||||
& ~(alert::progress_notification
|
||||
| alert::performance_warning
|
||||
| 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);
|
||||
lt::session ses(pack);
|
||||
|
||||
add_torrent_params p;
|
||||
|
|
|
@ -79,7 +79,7 @@ bool prioritize_files(torrent_handle const& h, std::vector<int> const& prio)
|
|||
void test_running_torrent(boost::shared_ptr<torrent_info> info, boost::int64_t file_size)
|
||||
{
|
||||
settings_pack pack = settings();
|
||||
pack.set_int(settings_pack::alert_mask, alert::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);
|
||||
|
|
|
@ -492,7 +492,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);
|
||||
|
||||
boost::scoped_ptr<lt::session> s(new lt::session(pack));
|
||||
|
||||
|
@ -649,7 +648,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);
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
#include "settings.hpp"
|
||||
#include "test_utils.hpp"
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
@ -55,8 +56,6 @@ namespace lt = libtorrent;
|
|||
|
||||
using boost::tuples::ignore;
|
||||
|
||||
const int mask = alert::all_categories & ~(alert::performance_warning | alert::stats_notification);
|
||||
|
||||
int peer_disconnects = 0;
|
||||
|
||||
bool on_alert(alert const* a)
|
||||
|
@ -145,9 +144,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);
|
||||
|
@ -204,7 +202,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);
|
||||
|
|
|
@ -43,6 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
#include "settings.hpp"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
|
@ -63,17 +64,11 @@ void test_transfer()
|
|||
session_proxy p1;
|
||||
session_proxy p2;
|
||||
|
||||
const int mask = alert::all_categories
|
||||
& ~(alert::progress_notification
|
||||
| alert::performance_warning
|
||||
| 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);
|
||||
|
|
|
@ -91,7 +91,6 @@ TORRENT_TEST(web_seed_redirect)
|
|||
{
|
||||
settings_pack p = settings();
|
||||
p.set_int(settings_pack::max_queued_disk_bytes, 256 * 1024);
|
||||
p.set_int(settings_pack::alert_mask, ~(alert::progress_notification | alert::stats_notification));
|
||||
libtorrent::session ses(p);
|
||||
|
||||
// disable keep-alive because otherwise the test will choke on seeing
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
@ -392,16 +393,10 @@ int EXPORT run_http_suite(int proxy, char const* protocol, bool test_url_seed
|
|||
}
|
||||
|
||||
{
|
||||
const int mask = alert::all_categories
|
||||
& ~(alert::progress_notification
|
||||
| alert::performance_warning
|
||||
| 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);
|
||||
|
|
Loading…
Reference in New Issue