deprecated alert::progress_notification alert category, split into finer grained categories
This commit is contained in:
parent
2a82bb5880
commit
6efff919cd
|
@ -1,3 +1,5 @@
|
||||||
|
* deprecated alert::progress_notification alert category, split into
|
||||||
|
finer grained categories
|
||||||
* update plugin interface functions for improved type-safety
|
* update plugin interface functions for improved type-safety
|
||||||
* implemented support magnet URI extension, select specific file indices
|
* implemented support magnet URI extension, select specific file indices
|
||||||
for download, BEP53
|
for download, BEP53
|
||||||
|
|
|
@ -275,7 +275,9 @@ void bind_alert()
|
||||||
s.attr("tracker_notification") = alert::tracker_notification;
|
s.attr("tracker_notification") = alert::tracker_notification;
|
||||||
s.attr("debug_notification") = alert::debug_notification;
|
s.attr("debug_notification") = alert::debug_notification;
|
||||||
s.attr("status_notification") = alert::status_notification;
|
s.attr("status_notification") = alert::status_notification;
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
s.attr("progress_notification") = alert::progress_notification;
|
s.attr("progress_notification") = alert::progress_notification;
|
||||||
|
#endif
|
||||||
s.attr("ip_block_notification") = alert::ip_block_notification;
|
s.attr("ip_block_notification") = alert::ip_block_notification;
|
||||||
s.attr("performance_warning") = alert::performance_warning;
|
s.attr("performance_warning") = alert::performance_warning;
|
||||||
s.attr("dht_notification") = alert::dht_notification;
|
s.attr("dht_notification") = alert::dht_notification;
|
||||||
|
@ -288,6 +290,10 @@ void bind_alert()
|
||||||
s.attr("dht_operation_notification") = alert::dht_operation_notification;
|
s.attr("dht_operation_notification") = alert::dht_operation_notification;
|
||||||
s.attr("port_mapping_log_notification") = alert::port_mapping_log_notification;
|
s.attr("port_mapping_log_notification") = alert::port_mapping_log_notification;
|
||||||
s.attr("picker_log_notification") = alert::picker_log_notification;
|
s.attr("picker_log_notification") = alert::picker_log_notification;
|
||||||
|
s.attr("file_progress_notification") = alert::file_progress_notification;
|
||||||
|
s.attr("piece_progress_notification") = alert::piece_progress_notification;
|
||||||
|
s.attr("upload_notification") = alert::upload_notification;
|
||||||
|
s.attr("block_progress_notification") = alert::block_progress_notification;
|
||||||
s.attr("all_categories") = alert::all_categories;
|
s.attr("all_categories") = alert::all_categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -216,3 +216,4 @@ pe
|
||||||
lt
|
lt
|
||||||
tex
|
tex
|
||||||
natpmp
|
natpmp
|
||||||
|
cancelled
|
||||||
|
|
|
@ -73,6 +73,17 @@ This means they are no longer heap allocated nor held by a smart pointer.
|
||||||
The ``clone()`` member on alerts was deprecated in 1.1 and removed in 1.2.
|
The ``clone()`` member on alerts was deprecated in 1.1 and removed in 1.2.
|
||||||
To pass alerts across threads, instead pull out the relevant information from the alerts and pass that across.
|
To pass alerts across threads, instead pull out the relevant information from the alerts and pass that across.
|
||||||
|
|
||||||
|
progress alert category
|
||||||
|
=======================
|
||||||
|
|
||||||
|
The ``alert::progress_notification`` category has been deprecated.
|
||||||
|
Alerts posted in this category are now also posted in one of these new categories:
|
||||||
|
|
||||||
|
* ``alert::block_progress_notification``
|
||||||
|
* ``alert::piece_progress_notification``
|
||||||
|
* ``alert::file_progress_notification``
|
||||||
|
* ``alert::upload_notification``
|
||||||
|
|
||||||
boost replaced by std
|
boost replaced by std
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
|
|
|
@ -1086,16 +1086,21 @@ example alert_masks:
|
||||||
settings.set_int(settings_pack::choking_algorithm, settings_pack::rate_based_choker);
|
settings.set_int(settings_pack::choking_algorithm, settings_pack::rate_based_choker);
|
||||||
|
|
||||||
settings.set_str(settings_pack::user_agent, "client_test/" LIBTORRENT_VERSION);
|
settings.set_str(settings_pack::user_agent, "client_test/" LIBTORRENT_VERSION);
|
||||||
settings.set_int(settings_pack::alert_mask, alert::all_categories
|
settings.set_int(settings_pack::alert_mask
|
||||||
& ~(alert::dht_notification
|
, alert::error_notification
|
||||||
| alert::progress_notification
|
| alert::peer_notification
|
||||||
| alert::stats_notification
|
| alert::port_mapping_notification
|
||||||
| alert::session_log_notification
|
| alert::storage_notification
|
||||||
| alert::torrent_log_notification
|
| alert::tracker_notification
|
||||||
| alert::peer_log_notification
|
| alert::debug_notification
|
||||||
| alert::dht_log_notification
|
| alert::status_notification
|
||||||
| alert::picker_log_notification
|
| alert::ip_block_notification
|
||||||
));
|
| alert::performance_warning
|
||||||
|
| alert::dht_notification
|
||||||
|
| alert::incoming_request_notification
|
||||||
|
| alert::dht_operation_notification
|
||||||
|
| alert::port_mapping_log_notification
|
||||||
|
| alert::file_progress_notification);
|
||||||
|
|
||||||
lt::time_duration refresh_delay = lt::milliseconds(500);
|
lt::time_duration refresh_delay = lt::milliseconds(500);
|
||||||
bool rate_limit_locals = false;
|
bool rate_limit_locals = false;
|
||||||
|
|
|
@ -70,12 +70,20 @@ namespace libtorrent {
|
||||||
// hidden
|
// hidden
|
||||||
using alert_category_t = flags::bitfield_flag<std::uint32_t, struct alert_category_tag>;
|
using alert_category_t = flags::bitfield_flag<std::uint32_t, struct alert_category_tag>;
|
||||||
|
|
||||||
|
#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.
|
// 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
|
// alert types are not copyable, and cannot be constructed by the client. The
|
||||||
// pointers returned by libtorrent are short lived (the details are described
|
// pointers returned by libtorrent are short lived (the details are described
|
||||||
// under session_handle::pop_alerts())
|
// under session_handle::pop_alerts())
|
||||||
class TORRENT_EXPORT alert
|
class TORRENT_EXPORT alert
|
||||||
{
|
{
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
public:
|
public:
|
||||||
|
|
||||||
alert(alert const& rhs) = delete;
|
alert(alert const& rhs) = delete;
|
||||||
|
@ -84,7 +92,7 @@ namespace libtorrent {
|
||||||
|
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
// only here for backwards compatibility
|
// 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
|
#endif
|
||||||
|
|
||||||
// Enables alerts that report an error. This includes:
|
// Enables alerts that report an error. This includes:
|
||||||
|
@ -120,9 +128,11 @@ namespace libtorrent {
|
||||||
// Enables alerts for when a torrent or the session changes state.
|
// Enables alerts for when a torrent or the session changes state.
|
||||||
static constexpr alert_category_t status_notification = 6_bit;
|
static constexpr alert_category_t status_notification = 6_bit;
|
||||||
|
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
// Alerts for when blocks are requested and completed. Also when
|
// Alerts for when blocks are requested and completed. Also when
|
||||||
// pieces are completed.
|
// pieces are completed.
|
||||||
static constexpr alert_category_t progress_notification = 7_bit;
|
static constexpr alert_category_t TORRENT_DEPRECATED_MEMBER progress_notification = 7_bit;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Alerts when a peer is blocked by the ip blocker or port blocker.
|
// Alerts when a peer is blocked by the ip blocker or port blocker.
|
||||||
static constexpr alert_category_t ip_block_notification = 8_bit;
|
static constexpr alert_category_t ip_block_notification = 8_bit;
|
||||||
|
@ -181,6 +191,20 @@ namespace libtorrent {
|
||||||
// enables verbose logging from the piece picker.
|
// enables verbose logging from the piece picker.
|
||||||
static constexpr alert_category_t picker_log_notification = 20_bit;
|
static constexpr alert_category_t picker_log_notification = 20_bit;
|
||||||
|
|
||||||
|
// alerts when files complete downloading
|
||||||
|
static constexpr alert_category_t file_progress_notification = 21_bit;
|
||||||
|
|
||||||
|
// alerts when pieces complete downloading or fail hash check
|
||||||
|
static constexpr alert_category_t piece_progress_notification = 22_bit;
|
||||||
|
|
||||||
|
// alerts when we upload blocks to other peers
|
||||||
|
static constexpr alert_category_t upload_notification = 23_bit;
|
||||||
|
|
||||||
|
// alerts on individual blocks being requested, downloading, finished,
|
||||||
|
// rejected, time-out and cancelled. This is likely to post alerts at a
|
||||||
|
// high rate.
|
||||||
|
static constexpr alert_category_t block_progress_notification = 24_bit;
|
||||||
|
|
||||||
// The full bitmask, representing all available categories.
|
// The full bitmask, representing all available categories.
|
||||||
//
|
//
|
||||||
// since the enum is signed, make sure this isn't
|
// since the enum is signed, make sure this isn't
|
||||||
|
|
|
@ -59,6 +59,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <boost/shared_array.hpp>
|
#include <boost/shared_array.hpp>
|
||||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||||
|
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
#define PROGRESS_NOTIFICATION | alert::progress_notification
|
||||||
|
#else
|
||||||
|
#define PROGRESS_NOTIFICATION
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
namespace libtorrent {
|
namespace libtorrent {
|
||||||
|
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
@ -254,7 +261,17 @@ namespace libtorrent {
|
||||||
|
|
||||||
TORRENT_DEFINE_ALERT(file_completed_alert, 6)
|
TORRENT_DEFINE_ALERT(file_completed_alert, 6)
|
||||||
|
|
||||||
static constexpr alert_category_t static_category = alert::progress_notification;
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
static constexpr alert_category_t static_category =
|
||||||
|
alert::file_progress_notification
|
||||||
|
PROGRESS_NOTIFICATION
|
||||||
|
;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
std::string message() const override;
|
std::string message() const override;
|
||||||
|
|
||||||
// refers to the index of the file that completed.
|
// refers to the index of the file that completed.
|
||||||
|
@ -809,7 +826,17 @@ namespace libtorrent {
|
||||||
|
|
||||||
TORRENT_DEFINE_ALERT(piece_finished_alert, 27)
|
TORRENT_DEFINE_ALERT(piece_finished_alert, 27)
|
||||||
|
|
||||||
static constexpr alert_category_t static_category = alert::progress_notification;
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
static constexpr alert_category_t static_category =
|
||||||
|
alert::piece_progress_notification
|
||||||
|
PROGRESS_NOTIFICATION
|
||||||
|
;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
std::string message() const override;
|
std::string message() const override;
|
||||||
|
|
||||||
// the index of the piece that finished
|
// the index of the piece that finished
|
||||||
|
@ -826,8 +853,18 @@ namespace libtorrent {
|
||||||
|
|
||||||
TORRENT_DEFINE_ALERT(request_dropped_alert, 28)
|
TORRENT_DEFINE_ALERT(request_dropped_alert, 28)
|
||||||
|
|
||||||
static constexpr alert_category_t static_category = alert::progress_notification
|
#ifdef __GNUC__
|
||||||
| alert::peer_notification;
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
static constexpr alert_category_t static_category =
|
||||||
|
alert::block_progress_notification
|
||||||
|
| alert::peer_notification
|
||||||
|
PROGRESS_NOTIFICATION
|
||||||
|
;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
std::string message() const override;
|
std::string message() const override;
|
||||||
|
|
||||||
int const block_index;
|
int const block_index;
|
||||||
|
@ -844,8 +881,18 @@ namespace libtorrent {
|
||||||
|
|
||||||
TORRENT_DEFINE_ALERT(block_timeout_alert, 29)
|
TORRENT_DEFINE_ALERT(block_timeout_alert, 29)
|
||||||
|
|
||||||
static constexpr alert_category_t static_category = alert::progress_notification
|
#ifdef __GNUC__
|
||||||
| alert::peer_notification;
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
static constexpr alert_category_t static_category =
|
||||||
|
alert::block_progress_notification
|
||||||
|
| alert::peer_notification
|
||||||
|
PROGRESS_NOTIFICATION
|
||||||
|
;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
std::string message() const override;
|
std::string message() const override;
|
||||||
|
|
||||||
int const block_index;
|
int const block_index;
|
||||||
|
@ -862,7 +909,17 @@ namespace libtorrent {
|
||||||
|
|
||||||
TORRENT_DEFINE_ALERT(block_finished_alert, 30)
|
TORRENT_DEFINE_ALERT(block_finished_alert, 30)
|
||||||
|
|
||||||
static constexpr alert_category_t static_category = alert::progress_notification;
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
static constexpr alert_category_t static_category =
|
||||||
|
alert::block_progress_notification
|
||||||
|
PROGRESS_NOTIFICATION
|
||||||
|
;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
std::string message() const override;
|
std::string message() const override;
|
||||||
|
|
||||||
int const block_index;
|
int const block_index;
|
||||||
|
@ -879,7 +936,17 @@ namespace libtorrent {
|
||||||
|
|
||||||
TORRENT_DEFINE_ALERT(block_downloading_alert, 31)
|
TORRENT_DEFINE_ALERT(block_downloading_alert, 31)
|
||||||
|
|
||||||
static constexpr alert_category_t static_category = alert::progress_notification;
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
static constexpr alert_category_t static_category =
|
||||||
|
alert::block_progress_notification
|
||||||
|
PROGRESS_NOTIFICATION
|
||||||
|
;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
std::string message() const override;
|
std::string message() const override;
|
||||||
|
|
||||||
int const block_index;
|
int const block_index;
|
||||||
|
@ -2710,7 +2777,7 @@ namespace libtorrent {
|
||||||
// This alert is posted when a block intended to be sent to a peer is placed in the
|
// This alert is posted when a block intended to be sent to a peer is placed in the
|
||||||
// send buffer. Note that if the connection is closed before the send buffer is sent,
|
// send buffer. Note that if the connection is closed before the send buffer is sent,
|
||||||
// the alert may be posted without the bytes having been sent to the peer.
|
// the alert may be posted without the bytes having been sent to the peer.
|
||||||
// It belongs to the ``progress_notification`` category.
|
// It belongs to the ``upload_notification`` category.
|
||||||
struct TORRENT_EXPORT block_uploaded_alert final : peer_alert
|
struct TORRENT_EXPORT block_uploaded_alert final : peer_alert
|
||||||
{
|
{
|
||||||
// internal
|
// internal
|
||||||
|
@ -2720,7 +2787,17 @@ namespace libtorrent {
|
||||||
|
|
||||||
TORRENT_DEFINE_ALERT(block_uploaded_alert, 94)
|
TORRENT_DEFINE_ALERT(block_uploaded_alert, 94)
|
||||||
|
|
||||||
static constexpr alert_category_t static_category = alert::progress_notification;
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
static constexpr alert_category_t static_category =
|
||||||
|
alert::upload_notification
|
||||||
|
PROGRESS_NOTIFICATION
|
||||||
|
;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
std::string message() const override;
|
std::string message() const override;
|
||||||
|
|
||||||
int const block_index;
|
int const block_index;
|
||||||
|
@ -2730,6 +2807,7 @@ namespace libtorrent {
|
||||||
#undef TORRENT_DEFINE_ALERT_IMPL
|
#undef TORRENT_DEFINE_ALERT_IMPL
|
||||||
#undef TORRENT_DEFINE_ALERT
|
#undef TORRENT_DEFINE_ALERT
|
||||||
#undef TORRENT_DEFINE_ALERT_PRIO
|
#undef TORRENT_DEFINE_ALERT_PRIO
|
||||||
|
#undef PROGRESS_NOTIFICATION
|
||||||
|
|
||||||
constexpr int num_alert_types = 95; // this constant represents "max_alert_index" + 1
|
constexpr int num_alert_types = 95; // this constant represents "max_alert_index" + 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,7 +370,7 @@ void run_test(lt::aux::proxy_settings ps, std::string url, int expect_size, int
|
||||||
});
|
});
|
||||||
|
|
||||||
http.register_handler("/redirect"
|
http.register_handler("/redirect"
|
||||||
, [&data_buffer,&counters](std::string method, std::string req
|
, [&counters](std::string method, std::string req
|
||||||
, std::map<std::string, std::string>&)
|
, std::map<std::string, std::string>&)
|
||||||
{
|
{
|
||||||
++counters[redirect_req];
|
++counters[redirect_req];
|
||||||
|
@ -381,7 +381,7 @@ void run_test(lt::aux::proxy_settings ps, std::string url, int expect_size, int
|
||||||
});
|
});
|
||||||
|
|
||||||
http.register_handler("/relative/redirect"
|
http.register_handler("/relative/redirect"
|
||||||
, [&data_buffer,&counters](std::string method, std::string req
|
, [&counters](std::string method, std::string req
|
||||||
, std::map<std::string, std::string>&)
|
, std::map<std::string, std::string>&)
|
||||||
{
|
{
|
||||||
++counters[rel_redirect_req];
|
++counters[rel_redirect_req];
|
||||||
|
@ -392,7 +392,7 @@ void run_test(lt::aux::proxy_settings ps, std::string url, int expect_size, int
|
||||||
});
|
});
|
||||||
|
|
||||||
http.register_handler("/infinite/redirect"
|
http.register_handler("/infinite/redirect"
|
||||||
, [&data_buffer,&counters](std::string method, std::string req
|
, [&counters](std::string method, std::string req
|
||||||
, std::map<std::string, std::string>&)
|
, std::map<std::string, std::string>&)
|
||||||
{
|
{
|
||||||
++counters[inf_redirect_req];
|
++counters[inf_redirect_req];
|
||||||
|
|
|
@ -512,7 +512,7 @@ TORRENT_TEST(torrent_completed_alert)
|
||||||
// add session
|
// add session
|
||||||
, [](lt::settings_pack& pack)
|
, [](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
|
// add torrent
|
||||||
, [](lt::add_torrent_params&) {}
|
, [](lt::add_torrent_params&) {}
|
||||||
|
@ -550,7 +550,7 @@ TORRENT_TEST(block_uploaded_alert)
|
||||||
, [](lt::settings_pack& pack)
|
, [](lt::settings_pack& pack)
|
||||||
{
|
{
|
||||||
pack.set_int(lt::settings_pack::alert_mask,
|
pack.set_int(lt::settings_pack::alert_mask,
|
||||||
alert::progress_notification | alert::status_notification);
|
alert::upload_notification | alert::status_notification);
|
||||||
}
|
}
|
||||||
// add torrent
|
// add torrent
|
||||||
, [](lt::add_torrent_params&) {}
|
, [](lt::add_torrent_params&) {}
|
||||||
|
|
|
@ -74,7 +74,6 @@ void test_interval(int interval)
|
||||||
sim::default_config network_cfg;
|
sim::default_config network_cfg;
|
||||||
sim::simulation sim{network_cfg};
|
sim::simulation sim{network_cfg};
|
||||||
|
|
||||||
lt::time_point start = lt::clock_type::now();
|
|
||||||
bool ran_to_completion = false;
|
bool ran_to_completion = false;
|
||||||
|
|
||||||
sim::asio::io_service web_server(sim, address_v4::from_string("2.2.2.2"));
|
sim::asio::io_service web_server(sim, address_v4::from_string("2.2.2.2"));
|
||||||
|
@ -85,7 +84,7 @@ void test_interval(int interval)
|
||||||
std::vector<lt::time_point> announces;
|
std::vector<lt::time_point> announces;
|
||||||
|
|
||||||
http.register_handler("/announce"
|
http.register_handler("/announce"
|
||||||
, [&announces,interval,start,&ran_to_completion](std::string /* method */
|
, [&announces,interval,&ran_to_completion](std::string /* method */
|
||||||
, std::string /* req */
|
, std::string /* req */
|
||||||
, std::map<std::string, std::string>&)
|
, std::map<std::string, std::string>&)
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,7 +62,9 @@ namespace libtorrent {
|
||||||
constexpr alert_category_t alert::tracker_notification;
|
constexpr alert_category_t alert::tracker_notification;
|
||||||
constexpr alert_category_t alert::debug_notification;
|
constexpr alert_category_t alert::debug_notification;
|
||||||
constexpr alert_category_t alert::status_notification;
|
constexpr alert_category_t alert::status_notification;
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
constexpr alert_category_t alert::progress_notification;
|
constexpr alert_category_t alert::progress_notification;
|
||||||
|
#endif
|
||||||
constexpr alert_category_t alert::ip_block_notification;
|
constexpr alert_category_t alert::ip_block_notification;
|
||||||
constexpr alert_category_t alert::performance_warning;
|
constexpr alert_category_t alert::performance_warning;
|
||||||
constexpr alert_category_t alert::dht_notification;
|
constexpr alert_category_t alert::dht_notification;
|
||||||
|
@ -75,6 +77,11 @@ namespace libtorrent {
|
||||||
constexpr alert_category_t alert::dht_operation_notification;
|
constexpr alert_category_t alert::dht_operation_notification;
|
||||||
constexpr alert_category_t alert::port_mapping_log_notification;
|
constexpr alert_category_t alert::port_mapping_log_notification;
|
||||||
constexpr alert_category_t alert::picker_log_notification;
|
constexpr alert_category_t alert::picker_log_notification;
|
||||||
|
constexpr alert_category_t alert::file_progress_notification;
|
||||||
|
constexpr alert_category_t alert::piece_progress_notification;
|
||||||
|
constexpr alert_category_t alert::upload_notification;
|
||||||
|
constexpr alert_category_t alert::block_progress_notification;
|
||||||
|
|
||||||
constexpr alert_category_t alert::all_categories;
|
constexpr alert_category_t alert::all_categories;
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
constexpr alert_category_t alert::rss_notification;
|
constexpr alert_category_t alert::rss_notification;
|
||||||
|
|
|
@ -39,8 +39,11 @@ using namespace lt;
|
||||||
lt::settings_pack settings()
|
lt::settings_pack settings()
|
||||||
{
|
{
|
||||||
auto const mask = alert::all_categories
|
auto const mask = alert::all_categories
|
||||||
& ~(alert::progress_notification
|
& ~(
|
||||||
| alert::performance_warning
|
alert::performance_warning
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
| alert::progress_notification
|
||||||
|
#endif
|
||||||
| alert::stats_notification
|
| alert::stats_notification
|
||||||
| alert::picker_log_notification);
|
| alert::picker_log_notification);
|
||||||
|
|
||||||
|
|
|
@ -770,9 +770,16 @@ setup_transfer(lt::session* ses1, lt::session* ses2, lt::session* ses3
|
||||||
ses2->set_peer_class_filter(f);
|
ses2->set_peer_class_filter(f);
|
||||||
if (ses3) ses3->set_peer_class_filter(f);
|
if (ses3) ses3->set_peer_class_filter(f);
|
||||||
|
|
||||||
|
auto const mask = alert::all_categories
|
||||||
|
& ~(
|
||||||
|
alert::performance_warning
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
| alert::progress_notification
|
||||||
|
#endif
|
||||||
|
| alert::stats_notification);
|
||||||
|
|
||||||
settings_pack pack;
|
settings_pack pack;
|
||||||
pack.set_int(settings_pack::alert_mask
|
pack.set_int(settings_pack::alert_mask, mask);
|
||||||
, ~(alert::progress_notification | alert::stats_notification));
|
|
||||||
if (ses3) pack.set_bool(settings_pack::allow_multiple_connections_per_ip, true);
|
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::mixed_mode_algorithm, settings_pack::prefer_tcp);
|
||||||
pack.set_int(settings_pack::max_failcount, 1);
|
pack.set_int(settings_pack::max_failcount, 1);
|
||||||
|
|
|
@ -75,9 +75,11 @@ void test_swarm(test_flags_t const flags)
|
||||||
session_proxy p2;
|
session_proxy p2;
|
||||||
session_proxy p3;
|
session_proxy p3;
|
||||||
|
|
||||||
auto const mask = alert::all_categories
|
auto const mask = ~(
|
||||||
& ~(alert::progress_notification
|
alert::performance_warning
|
||||||
| alert::performance_warning
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
| alert::progress_notification
|
||||||
|
#endif
|
||||||
| alert::stats_notification);
|
| alert::stats_notification);
|
||||||
|
|
||||||
settings_pack pack;
|
settings_pack pack;
|
||||||
|
|
|
@ -65,9 +65,16 @@ TORRENT_TEST(alerts_types)
|
||||||
#else
|
#else
|
||||||
++count_alert_types;
|
++count_alert_types;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
#define PROGRESS_NOTIFICATION alert::progress_notification |
|
||||||
|
#else
|
||||||
|
#define PROGRESS_NOTIFICATION
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST_ALERT_TYPE(torrent_removed_alert, 4, 1, alert::status_notification);
|
TEST_ALERT_TYPE(torrent_removed_alert, 4, 1, alert::status_notification);
|
||||||
TEST_ALERT_TYPE(read_piece_alert, 5, 1, alert::storage_notification);
|
TEST_ALERT_TYPE(read_piece_alert, 5, 1, alert::storage_notification);
|
||||||
TEST_ALERT_TYPE(file_completed_alert, 6, 0, alert::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, 1, alert::storage_notification);
|
||||||
TEST_ALERT_TYPE(file_rename_failed_alert, 8, 1, alert::storage_notification);
|
TEST_ALERT_TYPE(file_rename_failed_alert, 8, 1, alert::storage_notification);
|
||||||
TEST_ALERT_TYPE(performance_alert, 9, 0, alert::performance_warning);
|
TEST_ALERT_TYPE(performance_alert, 9, 0, alert::performance_warning);
|
||||||
|
@ -88,11 +95,11 @@ TORRENT_TEST(alerts_types)
|
||||||
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, 0, alert::status_notification);
|
||||||
TEST_ALERT_TYPE(piece_finished_alert, 27, 0, alert::progress_notification);
|
TEST_ALERT_TYPE(piece_finished_alert, 27, 0, PROGRESS_NOTIFICATION alert::piece_progress_notification);
|
||||||
TEST_ALERT_TYPE(request_dropped_alert, 28, 0, alert::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, alert::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, alert::progress_notification);
|
TEST_ALERT_TYPE(block_finished_alert, 30, 0, PROGRESS_NOTIFICATION alert::block_progress_notification);
|
||||||
TEST_ALERT_TYPE(block_downloading_alert, 31, 0, alert::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, 1, alert::storage_notification);
|
||||||
TEST_ALERT_TYPE(storage_moved_failed_alert, 34, 1, alert::storage_notification);
|
TEST_ALERT_TYPE(storage_moved_failed_alert, 34, 1, alert::storage_notification);
|
||||||
|
@ -163,7 +170,7 @@ TORRENT_TEST(alerts_types)
|
||||||
TEST_ALERT_TYPE(dht_live_nodes_alert, 91, 0, alert::dht_notification);
|
TEST_ALERT_TYPE(dht_live_nodes_alert, 91, 0, alert::dht_notification);
|
||||||
TEST_ALERT_TYPE(session_stats_header_alert, 92, 0, alert::stats_notification);
|
TEST_ALERT_TYPE(session_stats_header_alert, 92, 0, alert::stats_notification);
|
||||||
TEST_ALERT_TYPE(dht_sample_infohashes_alert, 93, 0, alert::dht_operation_notification);
|
TEST_ALERT_TYPE(dht_sample_infohashes_alert, 93, 0, alert::dht_operation_notification);
|
||||||
TEST_ALERT_TYPE(block_uploaded_alert, 94, 0, alert::progress_notification);
|
TEST_ALERT_TYPE(block_uploaded_alert, 94, 0, PROGRESS_NOTIFICATION alert::upload_notification);
|
||||||
|
|
||||||
#undef TEST_ALERT_TYPE
|
#undef TEST_ALERT_TYPE
|
||||||
|
|
||||||
|
@ -324,3 +331,6 @@ TORRENT_TEST(dht_sample_infohashes_alert)
|
||||||
std::sort(nodes.begin(), nodes.end());
|
std::sort(nodes.begin(), nodes.end());
|
||||||
TEST_CHECK(nv == nodes);
|
TEST_CHECK(nv == nodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef PROGRESS_NOTIFICATION
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,11 @@ void test_pex()
|
||||||
session_proxy p2;
|
session_proxy p2;
|
||||||
session_proxy p3;
|
session_proxy p3;
|
||||||
|
|
||||||
auto const mask = alert::all_categories
|
auto const mask = ~(
|
||||||
& ~(alert::progress_notification
|
alert::performance_warning
|
||||||
| alert::performance_warning
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
| alert::progress_notification
|
||||||
|
#endif
|
||||||
| alert::stats_notification);
|
| alert::stats_notification);
|
||||||
|
|
||||||
// this is to avoid everything finish from a single peer
|
// this is to avoid everything finish from a single peer
|
||||||
|
|
|
@ -101,9 +101,12 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags)
|
||||||
|
|
||||||
int const prev_udp_announces = num_udp_announces();
|
int const prev_udp_announces = num_udp_announces();
|
||||||
|
|
||||||
auto const alert_mask = alert::all_categories
|
auto const alert_mask = ~(
|
||||||
& ~alert::progress_notification
|
alert::performance_warning
|
||||||
& ~alert::stats_notification;
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
| alert::progress_notification
|
||||||
|
#endif
|
||||||
|
| alert::stats_notification);
|
||||||
|
|
||||||
settings_pack sett = settings();
|
settings_pack sett = settings();
|
||||||
sett.set_int(settings_pack::stop_tracker_timeout, 2);
|
sett.set_int(settings_pack::stop_tracker_timeout, 2);
|
||||||
|
|
|
@ -91,9 +91,11 @@ void test_read_piece(int flags)
|
||||||
std::printf("generated torrent: %s tmp1_read_piece/test_torrent\n"
|
std::printf("generated torrent: %s tmp1_read_piece/test_torrent\n"
|
||||||
, aux::to_hex(ti->info_hash()).c_str());
|
, aux::to_hex(ti->info_hash()).c_str());
|
||||||
|
|
||||||
auto const mask = alert::all_categories
|
auto const mask = ~(
|
||||||
& ~(alert::progress_notification
|
alert::performance_warning
|
||||||
| alert::performance_warning
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
| alert::progress_notification
|
||||||
|
#endif
|
||||||
| alert::stats_notification);
|
| alert::stats_notification);
|
||||||
|
|
||||||
settings_pack sett;
|
settings_pack sett;
|
||||||
|
|
|
@ -263,14 +263,14 @@ void test_ssl(int test_idx, bool use_utp)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (st2.is_finished) break;
|
||||||
|
|
||||||
if (peer_disconnects >= 2)
|
if (peer_disconnects >= 2)
|
||||||
{
|
{
|
||||||
std::printf("too many disconnects (%d), breaking\n", peer_disconnects);
|
std::printf("too many disconnects (%d), breaking\n", peer_disconnects);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (st2.is_finished) break;
|
|
||||||
|
|
||||||
if (st2.state != torrent_status::downloading)
|
if (st2.state != torrent_status::downloading)
|
||||||
{
|
{
|
||||||
static char const* state_str[] =
|
static char const* state_str[] =
|
||||||
|
|
|
@ -62,9 +62,11 @@ void test_transfer()
|
||||||
session_proxy p1;
|
session_proxy p1;
|
||||||
session_proxy p2;
|
session_proxy p2;
|
||||||
|
|
||||||
auto const mask = alert::all_categories
|
auto const mask = ~(
|
||||||
& ~(alert::progress_notification
|
alert::performance_warning
|
||||||
| alert::performance_warning
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
| alert::progress_notification
|
||||||
|
#endif
|
||||||
| alert::stats_notification);
|
| alert::stats_notification);
|
||||||
|
|
||||||
settings_pack pack;
|
settings_pack pack;
|
||||||
|
|
|
@ -88,9 +88,16 @@ TORRENT_TEST(web_seed_redirect)
|
||||||
auto torrent_file = std::make_shared<torrent_info>(buf, ec, from_span);
|
auto torrent_file = std::make_shared<torrent_info>(buf, ec, from_span);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
auto const mask = ~(
|
||||||
|
alert::performance_warning
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
| alert::progress_notification
|
||||||
|
#endif
|
||||||
|
| alert::stats_notification);
|
||||||
|
|
||||||
settings_pack p = settings();
|
settings_pack p = settings();
|
||||||
p.set_int(settings_pack::max_queued_disk_bytes, 256 * 1024);
|
p.set_int(settings_pack::max_queued_disk_bytes, 256 * 1024);
|
||||||
p.set_int(settings_pack::alert_mask, ~(alert::progress_notification | alert::stats_notification));
|
p.set_int(settings_pack::alert_mask, mask);
|
||||||
lt::session ses(p);
|
lt::session ses(p);
|
||||||
|
|
||||||
// disable keep-alive because otherwise the test will choke on seeing
|
// disable keep-alive because otherwise the test will choke on seeing
|
||||||
|
|
|
@ -392,8 +392,11 @@ int EXPORT run_http_suite(int proxy, char const* protocol, bool test_url_seed
|
||||||
|
|
||||||
{
|
{
|
||||||
auto const mask = alert::all_categories
|
auto const mask = alert::all_categories
|
||||||
& ~(alert::progress_notification
|
& ~(
|
||||||
| alert::performance_warning
|
alert::performance_warning
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
| alert::progress_notification
|
||||||
|
#endif
|
||||||
| alert::stats_notification);
|
| alert::stats_notification);
|
||||||
|
|
||||||
settings_pack pack;
|
settings_pack pack;
|
||||||
|
|
Loading…
Reference in New Issue