merged RC_1_1 into master

This commit is contained in:
Arvid Norberg 2018-05-01 19:55:38 +02:00
commit 26b0487f0b
3 changed files with 79 additions and 69 deletions

View File

@ -75,6 +75,13 @@ namespace libtorrent {
// user defined alerts should use IDs greater than this // user defined alerts should use IDs greater than this
static const int user_alert_id = 10000; static const int user_alert_id = 10000;
enum alert_priority
{
alert_priority_normal = 0,
alert_priority_high,
alert_priority_critical
};
// This is a base class for alerts that are associated with a // This is a base class for alerts that are associated with a
// specific torrent. It contains a handle to the torrent. // specific torrent. It contains a handle to the torrent.
struct TORRENT_EXPORT torrent_alert : alert struct TORRENT_EXPORT torrent_alert : alert
@ -172,10 +179,10 @@ namespace libtorrent {
virtual char const* what() const noexcept override { return #name; } virtual char const* what() const noexcept override { return #name; }
#define TORRENT_DEFINE_ALERT(name, seq) \ #define TORRENT_DEFINE_ALERT(name, seq) \
TORRENT_DEFINE_ALERT_IMPL(name, seq, 0) TORRENT_DEFINE_ALERT_IMPL(name, seq, alert_priority_normal)
#define TORRENT_DEFINE_ALERT_PRIO(name, seq) \ #define TORRENT_DEFINE_ALERT_PRIO(name, seq, prio) \
TORRENT_DEFINE_ALERT_IMPL(name, seq, 1) TORRENT_DEFINE_ALERT_IMPL(name, seq, prio)
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
// The ``torrent_added_alert`` is posted once every time a torrent is successfully // The ``torrent_added_alert`` is posted once every time a torrent is successfully
@ -213,7 +220,7 @@ namespace libtorrent {
torrent_removed_alert(aux::stack_allocator& alloc torrent_removed_alert(aux::stack_allocator& alloc
, torrent_handle const& h, sha1_hash const& ih); , torrent_handle const& h, sha1_hash const& ih);
TORRENT_DEFINE_ALERT_PRIO(torrent_removed_alert, 4) TORRENT_DEFINE_ALERT_PRIO(torrent_removed_alert, 4, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification; static constexpr alert_category_t static_category = alert::status_notification;
std::string message() const override; std::string message() const override;
sha1_hash info_hash; sha1_hash info_hash;
@ -235,7 +242,7 @@ namespace libtorrent {
read_piece_alert(aux::stack_allocator& alloc, torrent_handle h read_piece_alert(aux::stack_allocator& alloc, torrent_handle h
, piece_index_t p, error_code e); , piece_index_t p, error_code e);
TORRENT_DEFINE_ALERT_PRIO(read_piece_alert, 5) TORRENT_DEFINE_ALERT_PRIO(read_piece_alert, 5, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification; static constexpr alert_category_t static_category = alert::storage_notification;
std::string message() const override; std::string message() const override;
@ -258,7 +265,7 @@ namespace libtorrent {
file_completed_alert(aux::stack_allocator& alloc, torrent_handle const& h file_completed_alert(aux::stack_allocator& alloc, torrent_handle const& h
, file_index_t idx); , file_index_t idx);
TORRENT_DEFINE_ALERT(file_completed_alert, 6) TORRENT_DEFINE_ALERT_PRIO(file_completed_alert, 6, alert_priority_normal)
#ifdef __GNUC__ #ifdef __GNUC__
#pragma GCC diagnostic push #pragma GCC diagnostic push
@ -285,7 +292,7 @@ namespace libtorrent {
file_renamed_alert(aux::stack_allocator& alloc, torrent_handle const& h file_renamed_alert(aux::stack_allocator& alloc, torrent_handle const& h
, string_view n, file_index_t idx); , string_view n, file_index_t idx);
TORRENT_DEFINE_ALERT_PRIO(file_renamed_alert, 7) TORRENT_DEFINE_ALERT_PRIO(file_renamed_alert, 7, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification; static constexpr alert_category_t static_category = alert::storage_notification;
std::string message() const override; std::string message() const override;
@ -321,7 +328,7 @@ namespace libtorrent {
, torrent_handle const& h, file_index_t idx , torrent_handle const& h, file_index_t idx
, error_code ec); , error_code ec);
TORRENT_DEFINE_ALERT_PRIO(file_rename_failed_alert, 8) TORRENT_DEFINE_ALERT_PRIO(file_rename_failed_alert, 8, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification; static constexpr alert_category_t static_category = alert::storage_notification;
@ -439,7 +446,7 @@ namespace libtorrent {
, torrent_status::state_t st , torrent_status::state_t st
, torrent_status::state_t prev_st); , torrent_status::state_t prev_st);
TORRENT_DEFINE_ALERT(state_changed_alert, 10) TORRENT_DEFINE_ALERT_PRIO(state_changed_alert, 10, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification; static constexpr alert_category_t static_category = alert::status_notification;
@ -468,7 +475,7 @@ namespace libtorrent {
, int times, string_view u , int times, string_view u
, error_code const& e, string_view m); , error_code const& e, string_view m);
TORRENT_DEFINE_ALERT(tracker_error_alert, 11) TORRENT_DEFINE_ALERT_PRIO(tracker_error_alert, 11, alert_priority_high)
static constexpr alert_category_t static_category = alert::tracker_notification | alert::error_notification; static constexpr alert_category_t static_category = alert::tracker_notification | alert::error_notification;
std::string message() const override; std::string message() const override;
@ -808,7 +815,7 @@ namespace libtorrent {
torrent_finished_alert(aux::stack_allocator& alloc, torrent_finished_alert(aux::stack_allocator& alloc,
torrent_handle h); torrent_handle h);
TORRENT_DEFINE_ALERT(torrent_finished_alert, 26) TORRENT_DEFINE_ALERT_PRIO(torrent_finished_alert, 26, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification; static constexpr alert_category_t static_category = alert::status_notification;
std::string message() const override; std::string message() const override;
@ -984,7 +991,7 @@ namespace libtorrent {
storage_moved_alert(aux::stack_allocator& alloc storage_moved_alert(aux::stack_allocator& alloc
, torrent_handle const& h, string_view p); , torrent_handle const& h, string_view p);
TORRENT_DEFINE_ALERT_PRIO(storage_moved_alert, 33) TORRENT_DEFINE_ALERT_PRIO(storage_moved_alert, 33, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification; static constexpr alert_category_t static_category = alert::storage_notification;
std::string message() const override; std::string message() const override;
@ -1009,7 +1016,7 @@ namespace libtorrent {
, torrent_handle const& h, error_code const& e, string_view file , torrent_handle const& h, error_code const& e, string_view file
, operation_t op); , operation_t op);
TORRENT_DEFINE_ALERT_PRIO(storage_moved_failed_alert, 34) TORRENT_DEFINE_ALERT_PRIO(storage_moved_failed_alert, 34, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification; static constexpr alert_category_t static_category = alert::storage_notification;
std::string message() const override; std::string message() const override;
@ -1046,7 +1053,7 @@ namespace libtorrent {
torrent_deleted_alert(aux::stack_allocator& alloc torrent_deleted_alert(aux::stack_allocator& alloc
, torrent_handle const& h, sha1_hash const& ih); , torrent_handle const& h, sha1_hash const& ih);
TORRENT_DEFINE_ALERT_PRIO(torrent_deleted_alert, 35) TORRENT_DEFINE_ALERT_PRIO(torrent_deleted_alert, 35, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification; static constexpr alert_category_t static_category = alert::storage_notification;
std::string message() const override; std::string message() const override;
@ -1062,7 +1069,7 @@ namespace libtorrent {
torrent_delete_failed_alert(aux::stack_allocator& alloc torrent_delete_failed_alert(aux::stack_allocator& alloc
, torrent_handle const& h, error_code const& e, sha1_hash const& ih); , torrent_handle const& h, error_code const& e, sha1_hash const& ih);
TORRENT_DEFINE_ALERT_PRIO(torrent_delete_failed_alert, 36) TORRENT_DEFINE_ALERT_PRIO(torrent_delete_failed_alert, 36, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification static constexpr alert_category_t static_category = alert::storage_notification
| alert::error_notification; | alert::error_notification;
@ -1088,7 +1095,7 @@ namespace libtorrent {
, add_torrent_params params , add_torrent_params params
, torrent_handle const& h); , torrent_handle const& h);
TORRENT_DEFINE_ALERT_PRIO(save_resume_data_alert, 37) TORRENT_DEFINE_ALERT_PRIO(save_resume_data_alert, 37, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification; static constexpr alert_category_t static_category = alert::storage_notification;
std::string message() const override; std::string message() const override;
@ -1112,7 +1119,7 @@ namespace libtorrent {
save_resume_data_failed_alert(aux::stack_allocator& alloc save_resume_data_failed_alert(aux::stack_allocator& alloc
, torrent_handle const& h, error_code const& e); , torrent_handle const& h, error_code const& e);
TORRENT_DEFINE_ALERT_PRIO(save_resume_data_failed_alert, 38) TORRENT_DEFINE_ALERT_PRIO(save_resume_data_failed_alert, 38, alert_priority_critical)
static constexpr alert_category_t static_category = alert::storage_notification static constexpr alert_category_t static_category = alert::storage_notification
| alert::error_notification; | alert::error_notification;
@ -1134,7 +1141,7 @@ namespace libtorrent {
// internal // internal
torrent_paused_alert(aux::stack_allocator& alloc, torrent_handle const& h); torrent_paused_alert(aux::stack_allocator& alloc, torrent_handle const& h);
TORRENT_DEFINE_ALERT(torrent_paused_alert, 39) TORRENT_DEFINE_ALERT_PRIO(torrent_paused_alert, 39, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification; static constexpr alert_category_t static_category = alert::status_notification;
std::string message() const override; std::string message() const override;
@ -1147,7 +1154,7 @@ namespace libtorrent {
// internal // internal
torrent_resumed_alert(aux::stack_allocator& alloc, torrent_handle const& h); torrent_resumed_alert(aux::stack_allocator& alloc, torrent_handle const& h);
TORRENT_DEFINE_ALERT(torrent_resumed_alert, 40) TORRENT_DEFINE_ALERT_PRIO(torrent_resumed_alert, 40, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification; static constexpr alert_category_t static_category = alert::status_notification;
std::string message() const override; std::string message() const override;
@ -1160,7 +1167,7 @@ namespace libtorrent {
// internal // internal
torrent_checked_alert(aux::stack_allocator& alloc, torrent_handle const& h); torrent_checked_alert(aux::stack_allocator& alloc, torrent_handle const& h);
TORRENT_DEFINE_ALERT(torrent_checked_alert, 41) TORRENT_DEFINE_ALERT_PRIO(torrent_checked_alert, 41, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification; static constexpr alert_category_t static_category = alert::status_notification;
std::string message() const override; std::string message() const override;
@ -1387,7 +1394,7 @@ namespace libtorrent {
listen_failed_alert(aux::stack_allocator& alloc, string_view iface listen_failed_alert(aux::stack_allocator& alloc, string_view iface
, operation_t op, error_code const& ec, libtorrent::socket_type_t t); , operation_t op, error_code const& ec, libtorrent::socket_type_t t);
TORRENT_DEFINE_ALERT_PRIO(listen_failed_alert, 48) TORRENT_DEFINE_ALERT_PRIO(listen_failed_alert, 48, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification | alert::error_notification; static constexpr alert_category_t static_category = alert::status_notification | alert::error_notification;
std::string message() const override; std::string message() const override;
@ -1471,7 +1478,7 @@ namespace libtorrent {
, udp::endpoint const& ep , udp::endpoint const& ep
, libtorrent::socket_type_t t); , libtorrent::socket_type_t t);
TORRENT_DEFINE_ALERT_PRIO(listen_succeeded_alert, 49) TORRENT_DEFINE_ALERT_PRIO(listen_succeeded_alert, 49, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification; static constexpr alert_category_t static_category = alert::status_notification;
std::string message() const override; std::string message() const override;
@ -1867,7 +1874,7 @@ namespace libtorrent {
torrent_error_alert(aux::stack_allocator& alloc, torrent_handle const& h torrent_error_alert(aux::stack_allocator& alloc, torrent_handle const& h
, error_code const& e, string_view f); , error_code const& e, string_view f);
TORRENT_DEFINE_ALERT(torrent_error_alert, 64) TORRENT_DEFINE_ALERT_PRIO(torrent_error_alert, 64, alert_priority_high)
static constexpr alert_category_t static_category = alert::error_notification | alert::status_notification; static constexpr alert_category_t static_category = alert::error_notification | alert::status_notification;
std::string message() const override; std::string message() const override;
@ -1898,7 +1905,7 @@ namespace libtorrent {
torrent_need_cert_alert(aux::stack_allocator& alloc torrent_need_cert_alert(aux::stack_allocator& alloc
, torrent_handle const& h); , torrent_handle const& h);
TORRENT_DEFINE_ALERT_PRIO(torrent_need_cert_alert, 65) TORRENT_DEFINE_ALERT_PRIO(torrent_need_cert_alert, 65, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification; static constexpr alert_category_t static_category = alert::status_notification;
std::string message() const override; std::string message() const override;
@ -1959,7 +1966,7 @@ namespace libtorrent {
add_torrent_alert(aux::stack_allocator& alloc, torrent_handle const& h add_torrent_alert(aux::stack_allocator& alloc, torrent_handle const& h
, add_torrent_params const& p, error_code const& ec); , add_torrent_params const& p, error_code const& ec);
TORRENT_DEFINE_ALERT_PRIO(add_torrent_alert, 67) TORRENT_DEFINE_ALERT_PRIO(add_torrent_alert, 67, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification; static constexpr alert_category_t static_category = alert::status_notification;
std::string message() const override; std::string message() const override;
@ -1982,7 +1989,7 @@ namespace libtorrent {
state_update_alert(aux::stack_allocator& alloc state_update_alert(aux::stack_allocator& alloc
, std::vector<torrent_status> st); , std::vector<torrent_status> st);
TORRENT_DEFINE_ALERT_PRIO(state_update_alert, 68) TORRENT_DEFINE_ALERT_PRIO(state_update_alert, 68, alert_priority_high)
static constexpr alert_category_t static_category = alert::status_notification; static constexpr alert_category_t static_category = alert::status_notification;
std::string message() const override; std::string message() const override;
@ -2048,7 +2055,7 @@ namespace libtorrent {
#pragma clang diagnostic ignored "-Wdeprecated-declarations" #pragma clang diagnostic ignored "-Wdeprecated-declarations"
#endif #endif
#endif #endif
TORRENT_DEFINE_ALERT_PRIO(session_stats_alert, 70) TORRENT_DEFINE_ALERT_PRIO(session_stats_alert, 70, alert_priority_critical)
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
#ifdef __GNUC__ #ifdef __GNUC__
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
@ -2103,7 +2110,7 @@ namespace libtorrent {
torrent_update_alert(aux::stack_allocator& alloc, torrent_handle h torrent_update_alert(aux::stack_allocator& alloc, torrent_handle h
, sha1_hash const& old_hash, sha1_hash const& new_hash); , sha1_hash const& old_hash, sha1_hash const& new_hash);
TORRENT_DEFINE_ALERT_PRIO(torrent_update_alert, 71) TORRENT_DEFINE_ALERT_PRIO(torrent_update_alert, 71, alert_priority_critical)
static constexpr alert_category_t static_category = alert::status_notification; static constexpr alert_category_t static_category = alert::status_notification;
std::string message() const override; std::string message() const override;
@ -2158,7 +2165,7 @@ namespace libtorrent {
dht_immutable_item_alert(aux::stack_allocator& alloc, sha1_hash const& t dht_immutable_item_alert(aux::stack_allocator& alloc, sha1_hash const& t
, entry const& i); , entry const& i);
TORRENT_DEFINE_ALERT_PRIO(dht_immutable_item_alert, 74) TORRENT_DEFINE_ALERT_PRIO(dht_immutable_item_alert, 74, alert_priority_critical)
static constexpr alert_category_t static_category = alert::dht_notification; static constexpr alert_category_t static_category = alert::dht_notification;
@ -2180,7 +2187,7 @@ namespace libtorrent {
, std::array<char, 32> k, std::array<char, 64> sig , std::array<char, 32> k, std::array<char, 64> sig
, std::int64_t sequence, string_view s, entry const& i, bool a); , std::int64_t sequence, string_view s, entry const& i, bool a);
TORRENT_DEFINE_ALERT_PRIO(dht_mutable_item_alert, 75) TORRENT_DEFINE_ALERT_PRIO(dht_mutable_item_alert, 75, alert_priority_critical)
static constexpr alert_category_t static_category = alert::dht_notification; static constexpr alert_category_t static_category = alert::dht_notification;
std::string message() const override; std::string message() const override;
@ -2619,7 +2626,7 @@ namespace libtorrent {
dht_direct_response_alert(aux::stack_allocator& alloc, void* userdata dht_direct_response_alert(aux::stack_allocator& alloc, void* userdata
, udp::endpoint const& addr); , udp::endpoint const& addr);
TORRENT_DEFINE_ALERT(dht_direct_response_alert, 88) TORRENT_DEFINE_ALERT_PRIO(dht_direct_response_alert, 88, alert_priority_critical)
static constexpr alert_category_t static_category = alert::dht_notification; static constexpr alert_category_t static_category = alert::dht_notification;
std::string message() const override; std::string message() const override;

View File

@ -51,8 +51,8 @@ TORRENT_TEST(limit)
// try add 600 torrent_add_alert to make sure we honor the limit of 500 // try add 600 torrent_add_alert to make sure we honor the limit of 500
// alerts. // alerts.
for (int i = 0; i < 600; ++i) for (piece_index_t i{0}; i < piece_index_t{600}; ++i)
mgr.emplace_alert<torrent_finished_alert>(torrent_handle()); mgr.emplace_alert<piece_finished_alert>(torrent_handle(), i);
TEST_EQUAL(mgr.pending(), true); TEST_EQUAL(mgr.pending(), true);
@ -67,8 +67,8 @@ TORRENT_TEST(limit)
// now, try lowering the limit and do the same thing again // now, try lowering the limit and do the same thing again
mgr.set_alert_queue_size_limit(200); mgr.set_alert_queue_size_limit(200);
for (int i = 0; i < 600; ++i) for (piece_index_t i{0}; i < piece_index_t{600}; ++i)
mgr.emplace_alert<torrent_finished_alert>(torrent_handle()); mgr.emplace_alert<piece_finished_alert>(torrent_handle(), i);
TEST_EQUAL(mgr.pending(), true); TEST_EQUAL(mgr.pending(), true);
@ -85,19 +85,19 @@ TORRENT_TEST(priority_limit)
TEST_EQUAL(mgr.alert_queue_size_limit(), 100); TEST_EQUAL(mgr.alert_queue_size_limit(), 100);
// this should only add 100 because of the limit // this should only add 100 because of the limit
for (int i = 0; i < 200; ++i) for (piece_index_t i{0}; i < piece_index_t{200}; ++i)
mgr.emplace_alert<add_torrent_alert>(torrent_handle(), add_torrent_params(), error_code()); mgr.emplace_alert<piece_finished_alert>(torrent_handle(), i);
// the limit is twice as high for priority alerts // the limit is twice as high for priority alerts
for (file_index_t i(0); i < file_index_t(200); ++i) for (file_index_t i(0); i < file_index_t(300); ++i)
mgr.emplace_alert<file_rename_failed_alert>(torrent_handle(), i, error_code()); mgr.emplace_alert<file_rename_failed_alert>(torrent_handle(), i, error_code());
std::vector<alert*> alerts; std::vector<alert*> alerts;
mgr.get_all(alerts); mgr.get_all(alerts);
// even though we posted 400, the limit was 100 for half of them and // even though we posted 500, the limit was 100 for half of them and
// 200 for the other half, meaning we should have 200 alerts now // 100 + 200 for the other half, meaning we should have 300 alerts now
TEST_EQUAL(alerts.size(), 200); TEST_EQUAL(alerts.size(), 300);
} }
namespace { namespace {
@ -265,10 +265,13 @@ TORRENT_TEST(dropped_alerts)
// still nothing, there's space for one alert // still nothing, there's space for one alert
TEST_CHECK(mgr.dropped_alerts().none()); TEST_CHECK(mgr.dropped_alerts().none());
mgr.emplace_alert<torrent_finished_alert>(torrent_handle()); mgr.emplace_alert<torrent_finished_alert>(torrent_handle());
// still nothing, there's space for one alert
TEST_CHECK(mgr.dropped_alerts().none());
mgr.emplace_alert<torrent_finished_alert>(torrent_handle());
// that last alert got dropped though, since it would have brought the queue // that last alert got dropped though, since it would have brought the queue
// size to 2 // size to 3
auto const d = mgr.dropped_alerts(); auto const d = mgr.dropped_alerts();
TEST_CHECK(d.count() == 1); TEST_EQUAL(d.count(), 1);
TEST_CHECK(d.test(torrent_finished_alert::alert_type)); TEST_CHECK(d.test(torrent_finished_alert::alert_type));
// it should have been cleared now though // it should have been cleared now though

View File

@ -72,14 +72,14 @@ TORRENT_TEST(alerts_types)
#define PROGRESS_NOTIFICATION #define PROGRESS_NOTIFICATION
#endif #endif
TEST_ALERT_TYPE(torrent_removed_alert, 4, 1, alert::status_notification); TEST_ALERT_TYPE(torrent_removed_alert, 4, 2, alert::status_notification);
TEST_ALERT_TYPE(read_piece_alert, 5, 1, alert::storage_notification); TEST_ALERT_TYPE(read_piece_alert, 5, 2, alert::storage_notification);
TEST_ALERT_TYPE(file_completed_alert, 6, 0, PROGRESS_NOTIFICATION alert::file_progress_notification); TEST_ALERT_TYPE(file_completed_alert, 6, 0, PROGRESS_NOTIFICATION alert::file_progress_notification);
TEST_ALERT_TYPE(file_renamed_alert, 7, 1, alert::storage_notification); TEST_ALERT_TYPE(file_renamed_alert, 7, 2, alert::storage_notification);
TEST_ALERT_TYPE(file_rename_failed_alert, 8, 1, alert::storage_notification); TEST_ALERT_TYPE(file_rename_failed_alert, 8, 2, alert::storage_notification);
TEST_ALERT_TYPE(performance_alert, 9, 0, alert::performance_warning); TEST_ALERT_TYPE(performance_alert, 9, 0, alert::performance_warning);
TEST_ALERT_TYPE(state_changed_alert, 10, 0, alert::status_notification); TEST_ALERT_TYPE(state_changed_alert, 10, 1, alert::status_notification);
TEST_ALERT_TYPE(tracker_error_alert, 11, 0, alert::tracker_notification | alert::error_notification); TEST_ALERT_TYPE(tracker_error_alert, 11, 1, alert::tracker_notification | alert::error_notification);
TEST_ALERT_TYPE(tracker_warning_alert, 12, 0, alert::tracker_notification | alert::error_notification); TEST_ALERT_TYPE(tracker_warning_alert, 12, 0, alert::tracker_notification | alert::error_notification);
TEST_ALERT_TYPE(scrape_reply_alert, 13, 0, alert::tracker_notification); TEST_ALERT_TYPE(scrape_reply_alert, 13, 0, alert::tracker_notification);
TEST_ALERT_TYPE(scrape_failed_alert, 14, 0, alert::tracker_notification | alert::error_notification); TEST_ALERT_TYPE(scrape_failed_alert, 14, 0, alert::tracker_notification | alert::error_notification);
@ -94,30 +94,30 @@ TORRENT_TEST(alerts_types)
TEST_ALERT_TYPE(peer_connect_alert, 23, 0, alert::debug_notification); TEST_ALERT_TYPE(peer_connect_alert, 23, 0, alert::debug_notification);
TEST_ALERT_TYPE(peer_disconnected_alert, 24, 0, alert::debug_notification); TEST_ALERT_TYPE(peer_disconnected_alert, 24, 0, alert::debug_notification);
TEST_ALERT_TYPE(invalid_request_alert, 25, 0, alert::peer_notification); TEST_ALERT_TYPE(invalid_request_alert, 25, 0, alert::peer_notification);
TEST_ALERT_TYPE(torrent_finished_alert, 26, 0, alert::status_notification); TEST_ALERT_TYPE(torrent_finished_alert, 26, 1, alert::status_notification);
TEST_ALERT_TYPE(piece_finished_alert, 27, 0, PROGRESS_NOTIFICATION alert::piece_progress_notification); TEST_ALERT_TYPE(piece_finished_alert, 27, 0, PROGRESS_NOTIFICATION alert::piece_progress_notification);
TEST_ALERT_TYPE(request_dropped_alert, 28, 0, PROGRESS_NOTIFICATION alert::block_progress_notification | alert::peer_notification); TEST_ALERT_TYPE(request_dropped_alert, 28, 0, PROGRESS_NOTIFICATION alert::block_progress_notification | alert::peer_notification);
TEST_ALERT_TYPE(block_timeout_alert, 29, 0, PROGRESS_NOTIFICATION alert::block_progress_notification | alert::peer_notification); TEST_ALERT_TYPE(block_timeout_alert, 29, 0, PROGRESS_NOTIFICATION alert::block_progress_notification | alert::peer_notification);
TEST_ALERT_TYPE(block_finished_alert, 30, 0, PROGRESS_NOTIFICATION alert::block_progress_notification); TEST_ALERT_TYPE(block_finished_alert, 30, 0, PROGRESS_NOTIFICATION alert::block_progress_notification);
TEST_ALERT_TYPE(block_downloading_alert, 31, 0, PROGRESS_NOTIFICATION alert::block_progress_notification); TEST_ALERT_TYPE(block_downloading_alert, 31, 0, PROGRESS_NOTIFICATION alert::block_progress_notification);
TEST_ALERT_TYPE(unwanted_block_alert, 32, 0, alert::peer_notification); TEST_ALERT_TYPE(unwanted_block_alert, 32, 0, alert::peer_notification);
TEST_ALERT_TYPE(storage_moved_alert, 33, 1, alert::storage_notification); TEST_ALERT_TYPE(storage_moved_alert, 33, 2, alert::storage_notification);
TEST_ALERT_TYPE(storage_moved_failed_alert, 34, 1, alert::storage_notification); TEST_ALERT_TYPE(storage_moved_failed_alert, 34, 2, alert::storage_notification);
TEST_ALERT_TYPE(torrent_deleted_alert, 35, 1, alert::storage_notification); TEST_ALERT_TYPE(torrent_deleted_alert, 35, 2, alert::storage_notification);
TEST_ALERT_TYPE(torrent_delete_failed_alert, 36, 1, alert::storage_notification | alert::error_notification); TEST_ALERT_TYPE(torrent_delete_failed_alert, 36, 2, alert::storage_notification | alert::error_notification);
TEST_ALERT_TYPE(save_resume_data_alert, 37, 1, alert::storage_notification); TEST_ALERT_TYPE(save_resume_data_alert, 37, 2, alert::storage_notification);
TEST_ALERT_TYPE(save_resume_data_failed_alert, 38, 1, alert::storage_notification | alert::error_notification); TEST_ALERT_TYPE(save_resume_data_failed_alert, 38, 2, alert::storage_notification | alert::error_notification);
TEST_ALERT_TYPE(torrent_paused_alert, 39, 0, alert::status_notification); TEST_ALERT_TYPE(torrent_paused_alert, 39, 1, alert::status_notification);
TEST_ALERT_TYPE(torrent_resumed_alert, 40, 0, alert::status_notification); TEST_ALERT_TYPE(torrent_resumed_alert, 40, 1, alert::status_notification);
TEST_ALERT_TYPE(torrent_checked_alert, 41, 0, alert::status_notification); TEST_ALERT_TYPE(torrent_checked_alert, 41, 1, alert::status_notification);
TEST_ALERT_TYPE(url_seed_alert, 42, 0, alert::peer_notification | alert::error_notification); TEST_ALERT_TYPE(url_seed_alert, 42, 0, alert::peer_notification | alert::error_notification);
TEST_ALERT_TYPE(file_error_alert, 43, 0, alert::status_notification | alert::error_notification | alert::storage_notification); TEST_ALERT_TYPE(file_error_alert, 43, 0, alert::status_notification | alert::error_notification | alert::storage_notification);
TEST_ALERT_TYPE(metadata_failed_alert, 44, 0, alert::error_notification); TEST_ALERT_TYPE(metadata_failed_alert, 44, 0, alert::error_notification);
TEST_ALERT_TYPE(metadata_received_alert, 45, 0, alert::status_notification); TEST_ALERT_TYPE(metadata_received_alert, 45, 0, alert::status_notification);
TEST_ALERT_TYPE(udp_error_alert, 46, 0, alert::error_notification); TEST_ALERT_TYPE(udp_error_alert, 46, 0, alert::error_notification);
TEST_ALERT_TYPE(external_ip_alert, 47, 0, alert::status_notification); TEST_ALERT_TYPE(external_ip_alert, 47, 0, alert::status_notification);
TEST_ALERT_TYPE(listen_failed_alert, 48, 1, alert::status_notification | alert::error_notification); TEST_ALERT_TYPE(listen_failed_alert, 48, 2, alert::status_notification | alert::error_notification);
TEST_ALERT_TYPE(listen_succeeded_alert, 49, 1, alert::status_notification); TEST_ALERT_TYPE(listen_succeeded_alert, 49, 2, alert::status_notification);
TEST_ALERT_TYPE(portmap_error_alert, 50, 0, alert::port_mapping_notification | alert::error_notification); TEST_ALERT_TYPE(portmap_error_alert, 50, 0, alert::port_mapping_notification | alert::error_notification);
TEST_ALERT_TYPE(portmap_alert, 51, 0, alert::port_mapping_notification); TEST_ALERT_TYPE(portmap_alert, 51, 0, alert::port_mapping_notification);
TEST_ALERT_TYPE(portmap_log_alert, 52, 0, alert::port_mapping_log_notification); TEST_ALERT_TYPE(portmap_log_alert, 52, 0, alert::port_mapping_log_notification);
@ -132,26 +132,26 @@ TORRENT_TEST(alerts_types)
TEST_ALERT_TYPE(trackerid_alert, 61, 0, alert::status_notification); TEST_ALERT_TYPE(trackerid_alert, 61, 0, alert::status_notification);
TEST_ALERT_TYPE(dht_bootstrap_alert, 62, 0, alert::dht_notification); TEST_ALERT_TYPE(dht_bootstrap_alert, 62, 0, alert::dht_notification);
count_alert_types++; // 63 is gone count_alert_types++; // 63 is gone
TEST_ALERT_TYPE(torrent_error_alert, 64, 0, alert::error_notification | alert::status_notification); TEST_ALERT_TYPE(torrent_error_alert, 64, 1, alert::error_notification | alert::status_notification);
TEST_ALERT_TYPE(torrent_need_cert_alert, 65, 1, alert::status_notification); TEST_ALERT_TYPE(torrent_need_cert_alert, 65, 2, alert::status_notification);
TEST_ALERT_TYPE(incoming_connection_alert, 66, 0, alert::peer_notification); TEST_ALERT_TYPE(incoming_connection_alert, 66, 0, alert::peer_notification);
TEST_ALERT_TYPE(add_torrent_alert, 67, 1, alert::status_notification); TEST_ALERT_TYPE(add_torrent_alert, 67, 2, alert::status_notification);
TEST_ALERT_TYPE(state_update_alert, 68, 1, alert::status_notification); TEST_ALERT_TYPE(state_update_alert, 68, 1, alert::status_notification);
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
TEST_ALERT_TYPE(mmap_cache_alert, 69, 0, alert::error_notification); TEST_ALERT_TYPE(mmap_cache_alert, 69, 0, alert::error_notification);
#else #else
count_alert_types++; count_alert_types++;
#endif #endif
TEST_ALERT_TYPE(session_stats_alert, 70, 1, alert::stats_notification); TEST_ALERT_TYPE(session_stats_alert, 70, 2, alert::stats_notification);
#ifndef TORRENT_NO_DEPRECATE #ifndef TORRENT_NO_DEPRECATE
TEST_ALERT_TYPE(torrent_update_alert, 71, 1, alert::status_notification); TEST_ALERT_TYPE(torrent_update_alert, 71, 2, alert::status_notification);
#else #else
count_alert_types++; count_alert_types++;
#endif #endif
count_alert_types++; // 72 is gone count_alert_types++; // 72 is gone
TEST_ALERT_TYPE(dht_error_alert, 73, 0, alert::error_notification | alert::dht_notification); TEST_ALERT_TYPE(dht_error_alert, 73, 0, alert::error_notification | alert::dht_notification);
TEST_ALERT_TYPE(dht_immutable_item_alert, 74, 1, alert::dht_notification); TEST_ALERT_TYPE(dht_immutable_item_alert, 74, 2, alert::dht_notification);
TEST_ALERT_TYPE(dht_mutable_item_alert, 75, 1, alert::dht_notification); TEST_ALERT_TYPE(dht_mutable_item_alert, 75, 2, alert::dht_notification);
TEST_ALERT_TYPE(dht_put_alert, 76, 0, alert::dht_notification); TEST_ALERT_TYPE(dht_put_alert, 76, 0, alert::dht_notification);
TEST_ALERT_TYPE(i2p_alert, 77, 0, alert::error_notification); TEST_ALERT_TYPE(i2p_alert, 77, 0, alert::error_notification);
TEST_ALERT_TYPE(dht_outgoing_get_peers_alert, 78, 0, alert::dht_notification); TEST_ALERT_TYPE(dht_outgoing_get_peers_alert, 78, 0, alert::dht_notification);
@ -164,7 +164,7 @@ TORRENT_TEST(alerts_types)
TEST_ALERT_TYPE(dht_log_alert, 85, 0, alert::dht_log_notification); TEST_ALERT_TYPE(dht_log_alert, 85, 0, alert::dht_log_notification);
TEST_ALERT_TYPE(dht_pkt_alert, 86, 0, alert::dht_log_notification); TEST_ALERT_TYPE(dht_pkt_alert, 86, 0, alert::dht_log_notification);
TEST_ALERT_TYPE(dht_get_peers_reply_alert, 87, 0, alert::dht_operation_notification); TEST_ALERT_TYPE(dht_get_peers_reply_alert, 87, 0, alert::dht_operation_notification);
TEST_ALERT_TYPE(dht_direct_response_alert, 88, 0, alert::dht_notification); TEST_ALERT_TYPE(dht_direct_response_alert, 88, 2, alert::dht_notification);
TEST_ALERT_TYPE(picker_log_alert, 89, 0, alert::picker_log_notification); TEST_ALERT_TYPE(picker_log_alert, 89, 0, alert::picker_log_notification);
TEST_ALERT_TYPE(session_error_alert, 90, 0, alert::error_notification); TEST_ALERT_TYPE(session_error_alert, 90, 0, alert::error_notification);
TEST_ALERT_TYPE(dht_live_nodes_alert, 91, 0, alert::dht_notification); TEST_ALERT_TYPE(dht_live_nodes_alert, 91, 0, alert::dht_notification);