make alert category flags be a strong type

This commit is contained in:
arvidn 2017-07-25 21:33:10 -07:00 committed by Arvid Norberg
parent c167e28788
commit b38efb6c65
26 changed files with 354 additions and 234 deletions

View File

@ -235,6 +235,8 @@ namespace boost
#undef POLY
}
struct dummy3 {};
void bind_alert()
{
using boost::noncopyable;
@ -263,31 +265,28 @@ void bind_alert()
;
#endif
enum_<alert::category_t>("category_t")
.value("error_notification", alert::error_notification)
.value("peer_notification", alert::peer_notification)
.value("port_mapping_notification", alert::port_mapping_notification)
.value("storage_notification", alert::storage_notification)
.value("tracker_notification", alert::tracker_notification)
.value("debug_notification", alert::debug_notification)
.value("status_notification", alert::status_notification)
.value("progress_notification", alert::progress_notification)
.value("ip_block_notification", alert::ip_block_notification)
.value("performance_warning", alert::performance_warning)
.value("dht_notification", alert::dht_notification)
.value("stats_notification", alert::stats_notification)
.value("session_log_notification", alert::session_log_notification)
.value("torrent_log_notification", alert::torrent_log_notification)
.value("peer_log_notification", alert::peer_log_notification)
.value("incoming_request_notification", alert::incoming_request_notification)
.value("dht_log_notification", alert::dht_log_notification)
.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)
// deliberately not INT_MAX. Arch linux crash while throwing an exception
.value("all_categories", (alert::category_t)0xfffffff)
;
scope s = class_<dummy3>("category_t");
s.attr("error_notification") = alert::error_notification;
s.attr("peer_notification") = alert::peer_notification;
s.attr("port_mapping_notification") = alert::port_mapping_notification;
s.attr("storage_notification") = alert::storage_notification;
s.attr("tracker_notification") = alert::tracker_notification;
s.attr("debug_notification") = alert::debug_notification;
s.attr("status_notification") = alert::status_notification;
s.attr("progress_notification") = alert::progress_notification;
s.attr("ip_block_notification") = alert::ip_block_notification;
s.attr("performance_warning") = alert::performance_warning;
s.attr("dht_notification") = alert::dht_notification;
s.attr("stats_notification") = alert::stats_notification;
s.attr("session_log_notification") = alert::session_log_notification;
s.attr("torrent_log_notification") = alert::torrent_log_notification;
s.attr("peer_log_notification") = alert::peer_log_notification;
s.attr("incoming_request_notification") = alert::incoming_request_notification;
s.attr("dht_log_notification") = alert::dht_log_notification;
s.attr("dht_operation_notification") = alert::dht_operation_notification;
s.attr("port_mapping_log_notification") = alert::port_mapping_log_notification;
s.attr("picker_log_notification") = alert::picker_log_notification;
s.attr("all_categories") = alert::all_categories;
}
enum_<operation_t>("operation_t")

View File

@ -15,6 +15,7 @@
#include "libtorrent/aux_/noexcept_movable.hpp"
#include "libtorrent/peer_info.hpp"
#include "libtorrent/alert_types.hpp" // for picker_flags_t
#include "libtorrent/alert.hpp"
#include <vector>
using namespace boost::python;
@ -297,6 +298,7 @@ void bind_converters()
to_python_converter<lt::bandwidth_state_flags_t, from_bitfield_flag<lt::bandwidth_state_flags_t>>();
to_python_converter<lt::file_open_mode_t, from_bitfield_flag<lt::file_open_mode_t>>();
to_python_converter<lt::picker_flags_t, from_bitfield_flag<lt::picker_flags_t>>();
to_python_converter<lt::alert_category_t, from_bitfield_flag<lt::alert_category_t>>();
// work-around types
to_python_converter<lt::aux::noexcept_movable<lt::address>, address_to_tuple<
@ -345,4 +347,5 @@ void bind_converters()
to_bitfield_flag<lt::bandwidth_state_flags_t>();
to_bitfield_flag<lt::file_open_mode_t>();
to_bitfield_flag<lt::picker_flags_t>();
to_bitfield_flag<lt::alert_category_t>();
}

View File

@ -1260,13 +1260,13 @@ MAGNETURL is a magnet link
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::progress_notification
+ alert::stats_notification
+ alert::session_log_notification
+ alert::torrent_log_notification
+ alert::peer_log_notification
+ alert::dht_log_notification
+ alert::picker_log_notification
| alert::progress_notification
| alert::stats_notification
| alert::session_log_notification
| alert::torrent_log_notification
| alert::peer_log_notification
| alert::dht_log_notification
| alert::picker_log_notification
));
lt::session ses(std::move(params));

View File

@ -43,7 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
//
// By default, only errors are reported. settings_pack::alert_mask can be
// used to specify which kinds of events should be reported. The alert mask is
// comprised by bits from the category_t enum.
// a combination of the alert_category_t flags in the alert class.
//
// Every alert belongs to one or more category. There is a cost associated with
// posting alerts. Only alerts that belong to an enabled category are
@ -63,9 +63,14 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/time.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/flags.hpp"
namespace libtorrent {
// hidden
struct alert_category_tag;
using alert_category_t = flags::bitfield_flag<std::uint32_t, alert_category_tag>;
// 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
@ -83,112 +88,107 @@ namespace libtorrent {
enum TORRENT_DEPRECATED severity_t { debug, info, warning, critical, fatal, none };
#endif
// these are bits for the alert_mask used by the session. See
// settings_pack::alert_mask.
enum category_t
{
// Enables alerts that report an error. This includes:
//
// * tracker errors
// * tracker warnings
// * file errors
// * resume data failures
// * web seed errors
// * .torrent files errors
// * listen socket errors
// * port mapping errors
error_notification = 0x1,
// Enables alerts that report an error. This includes:
//
// * tracker errors
// * tracker warnings
// * file errors
// * resume data failures
// * web seed errors
// * .torrent files errors
// * listen socket errors
// * port mapping errors
static constexpr alert_category_t error_notification{0x1};
// Enables alerts when peers send invalid requests, get banned or
// snubbed.
peer_notification = 0x2,
// Enables alerts when peers send invalid requests, get banned or
// snubbed.
static constexpr alert_category_t peer_notification{0x2};
// Enables alerts for port mapping events. For NAT-PMP and UPnP.
port_mapping_notification = 0x4,
// Enables alerts for port mapping events. For NAT-PMP and UPnP.
static constexpr alert_category_t port_mapping_notification{0x4};
// Enables alerts for events related to the storage. File errors and
// synchronization events for moving the storage, renaming files etc.
storage_notification = 0x8,
// Enables alerts for events related to the storage. File errors and
// synchronization events for moving the storage, renaming files etc.
static constexpr alert_category_t storage_notification{0x8};
// Enables all tracker events. Includes announcing to trackers,
// receiving responses, warnings and errors.
tracker_notification = 0x10,
// Enables all tracker events. Includes announcing to trackers,
// receiving responses, warnings and errors.
static constexpr alert_category_t tracker_notification{0x10};
// Low level alerts for when peers are connected and disconnected.
debug_notification = 0x20,
// Low level alerts for when peers are connected and disconnected.
static constexpr alert_category_t debug_notification{0x20};
// Enables alerts for when a torrent or the session changes state.
status_notification = 0x40,
// Enables alerts for when a torrent or the session changes state.
static constexpr alert_category_t status_notification{0x40};
// Alerts for when blocks are requested and completed. Also when
// pieces are completed.
progress_notification = 0x80,
// Alerts for when blocks are requested and completed. Also when
// pieces are completed.
static constexpr alert_category_t progress_notification{0x80};
// Alerts when a peer is blocked by the ip blocker or port blocker.
ip_block_notification = 0x100,
// Alerts when a peer is blocked by the ip blocker or port blocker.
static constexpr alert_category_t ip_block_notification{0x100};
// Alerts when some limit is reached that might limit the download
// or upload rate.
performance_warning = 0x200,
// Alerts when some limit is reached that might limit the download
// or upload rate.
static constexpr alert_category_t performance_warning{0x200};
// Alerts on events in the DHT node. For incoming searches or
// bootstrapping being done etc.
dht_notification = 0x400,
// Alerts on events in the DHT node. For incoming searches or
// bootstrapping being done etc.
static constexpr alert_category_t dht_notification{0x400};
// If you enable these alerts, you will receive a stats_alert
// approximately once every second, for every active torrent.
// These alerts contain all statistics counters for the interval since
// the lasts stats alert.
stats_notification = 0x800,
// If you enable these alerts, you will receive a stats_alert
// approximately once every second, for every active torrent.
// These alerts contain all statistics counters for the interval since
// the lasts stats alert.
static constexpr alert_category_t stats_notification{0x800};
#ifndef TORRENT_NO_DEPRECATE
// Alerts on RSS related events, like feeds being updated, feed error
// conditions and successful RSS feed updates. Enabling this category
// will make you receive rss_alert alerts.
rss_notification TORRENT_DEPRECATED_ENUM = 0x1000,
// Alerts on RSS related events, like feeds being updated, feed error
// conditions and successful RSS feed updates. Enabling this category
// will make you receive rss_alert alerts.
static constexpr alert_category_t TORRENT_DEPRECATED_MEMBER rss_notification{0x1000};
#endif
// Enables debug logging alerts. These are available unless libtorrent
// was built with logging disabled (``TORRENT_DISABLE_LOGGING``). The
// alerts being posted are log_alert and are session wide.
session_log_notification = 0x2000,
// Enables debug logging alerts. These are available unless libtorrent
// was built with logging disabled (``TORRENT_DISABLE_LOGGING``). The
// alerts being posted are log_alert and are session wide.
static constexpr alert_category_t session_log_notification{0x2000};
// Enables debug logging alerts for torrents. These are available
// unless libtorrent was built with logging disabled
// (``TORRENT_DISABLE_LOGGING``). The alerts being posted are
// torrent_log_alert and are torrent wide debug events.
torrent_log_notification = 0x4000,
// Enables debug logging alerts for torrents. These are available
// unless libtorrent was built with logging disabled
// (``TORRENT_DISABLE_LOGGING``). The alerts being posted are
// torrent_log_alert and are torrent wide debug events.
static constexpr alert_category_t torrent_log_notification{0x4000};
// Enables debug logging alerts for peers. These are available unless
// libtorrent was built with logging disabled
// (``TORRENT_DISABLE_LOGGING``). The alerts being posted are
// peer_log_alert and low-level peer events and messages.
peer_log_notification = 0x8000,
// Enables debug logging alerts for peers. These are available unless
// libtorrent was built with logging disabled
// (``TORRENT_DISABLE_LOGGING``). The alerts being posted are
// peer_log_alert and low-level peer events and messages.
static constexpr alert_category_t peer_log_notification{0x8000};
// enables the incoming_request_alert.
incoming_request_notification = 0x10000,
// enables the incoming_request_alert.
static constexpr alert_category_t incoming_request_notification{0x10000};
// enables dht_log_alert, debug logging for the DHT
dht_log_notification = 0x20000,
// enables dht_log_alert, debug logging for the DHT
static constexpr alert_category_t dht_log_notification{0x20000};
// enable events from pure dht operations not related to torrents
dht_operation_notification = 0x40000,
// enable events from pure dht operations not related to torrents
static constexpr alert_category_t dht_operation_notification{0x40000};
// enables port mapping log events. This log is useful
// for debugging the UPnP or NAT-PMP implementation
port_mapping_log_notification = 0x80000,
// enables port mapping log events. This log is useful
// for debugging the UPnP or NAT-PMP implementation
static constexpr alert_category_t port_mapping_log_notification{0x80000};
// enables verbose logging from the piece picker.
picker_log_notification = 0x100000,
// enables verbose logging from the piece picker.
static constexpr alert_category_t picker_log_notification{0x100000};
// The full bitmask, representing all available categories.
//
// since the enum is signed, make sure this isn't
// interpreted as -1. For instance, boost.python
// does that and fails when assigning it to an
// unsigned parameter.
all_categories = 0x7fffffff
};
// The full bitmask, representing all available categories.
//
// since the enum is signed, make sure this isn't
// interpreted as -1. For instance, boost.python
// does that and fails when assigning it to an
// unsigned parameter.
static constexpr alert_category_t all_categories{0x7fffffff};
// hidden
alert();
@ -242,7 +242,7 @@ namespace libtorrent {
virtual std::string message() const = 0;
// returns a bitmask specifying which categories this alert belong to.
virtual int category() const = 0;
virtual alert_category_t category() const = 0;
#ifndef TORRENT_NO_DEPRECATE

View File

@ -55,7 +55,7 @@ namespace libtorrent {
{
public:
alert_manager(int queue_limit
, std::uint32_t alert_mask = alert::error_notification);
, alert_category_t alert_mask = alert::error_notification);
~alert_manager();
template <class T, typename... Args>
@ -90,8 +90,7 @@ namespace libtorrent {
template <class T>
bool should_post() const
{
if ((m_alert_mask.load(std::memory_order_relaxed)
& T::static_category) == 0)
if (!(m_alert_mask.load(std::memory_order_relaxed) & T::static_category))
{
return false;
}
@ -101,12 +100,12 @@ namespace libtorrent {
alert* wait_for_alert(time_duration max_wait);
void set_alert_mask(std::uint32_t m)
void set_alert_mask(alert_category_t const m)
{
m_alert_mask = m;
}
std::uint32_t alert_mask() const
alert_category_t alert_mask() const
{
return m_alert_mask;
}
@ -131,7 +130,7 @@ namespace libtorrent {
mutable std::mutex m_mutex;
std::condition_variable m_condition;
std::atomic<std::uint32_t> m_alert_mask;
std::atomic<alert_category_t> m_alert_mask;
int m_queue_size_limit;
// this function (if set) is called whenever the number of alerts in

View File

@ -108,8 +108,8 @@ namespace libtorrent {
peer_alert(peer_alert&& rhs) noexcept = default;
static const int alert_type = 1;
static const int static_category = alert::peer_notification;
virtual int category() const override { return static_category; }
static constexpr alert_category_t static_category = alert::peer_notification;
virtual alert_category_t category() const override { return static_category; }
virtual std::string message() const override;
// The peer's IP address and port.
@ -134,8 +134,8 @@ namespace libtorrent {
, string_view u);
static const int alert_type = 2;
static const int static_category = alert::tracker_notification;
virtual int category() const override { return static_category; }
static constexpr alert_category_t static_category = alert::tracker_notification;
virtual alert_category_t category() const override { return static_category; }
virtual std::string message() const override;
// returns a 0-terminated string of the tracker's URL
@ -155,7 +155,7 @@ namespace libtorrent {
static const int priority = prio; \
static const int alert_type = seq; \
virtual int type() const override { return alert_type; } \
virtual int category() const override { return static_category; } \
virtual alert_category_t category() const override { return static_category; } \
virtual char const* what() const override { return #name; }
#define TORRENT_DEFINE_ALERT(name, seq) \
@ -177,7 +177,7 @@ namespace libtorrent {
torrent_added_alert(aux::stack_allocator& alloc, torrent_handle const& h);
TORRENT_DEFINE_ALERT(torrent_added_alert, 3)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
};
#endif
@ -201,7 +201,7 @@ namespace libtorrent {
, torrent_handle const& h, sha1_hash const& ih);
TORRENT_DEFINE_ALERT_PRIO(torrent_removed_alert, 4)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
sha1_hash info_hash;
};
@ -224,7 +224,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(read_piece_alert, 5)
static const int static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert::storage_notification;
virtual std::string message() const override;
error_code const error;
@ -247,7 +247,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(file_completed_alert, 6)
static const int static_category = alert::progress_notification;
static constexpr alert_category_t static_category = alert::progress_notification;
virtual std::string message() const override;
// refers to the index of the file that completed.
@ -264,7 +264,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(file_renamed_alert, 7)
static const int static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert::storage_notification;
virtual std::string message() const override;
char const* new_name() const;
@ -290,7 +290,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(file_rename_failed_alert, 8)
static const int static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert::storage_notification;
virtual std::string message() const override;
@ -391,7 +391,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(performance_alert, 9)
static const int static_category = alert::performance_warning;
static constexpr alert_category_t static_category = alert::performance_warning;
virtual std::string message() const override;
@ -408,7 +408,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(state_changed_alert, 10)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
@ -436,7 +436,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(tracker_error_alert, 11)
static const int static_category = alert::tracker_notification | alert::error_notification;
static constexpr alert_category_t static_category = alert::tracker_notification | alert::error_notification;
virtual std::string message() const override;
int const times_in_row;
@ -465,7 +465,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(tracker_warning_alert, 12)
static const int static_category = alert::tracker_notification | alert::error_notification;
static constexpr alert_category_t static_category = alert::tracker_notification | alert::error_notification;
virtual std::string message() const override;
// the message associated with this warning
@ -510,7 +510,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(scrape_failed_alert, 14)
static const int static_category = alert::tracker_notification | alert::error_notification;
static constexpr alert_category_t static_category = alert::tracker_notification | alert::error_notification;
virtual std::string message() const override;
// the error itself. This may indicate that the tracker sent an error
@ -561,6 +561,7 @@ namespace libtorrent {
, torrent_handle const& h
, int np);
static constexpr alert_category_t static_category = alert::dht_notification | alert::tracker_notification;
TORRENT_DEFINE_ALERT(dht_reply_alert, 16)
virtual std::string message() const override;
@ -601,7 +602,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(hash_failed_alert, 18)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
piece_index_t const piece_index;
@ -657,7 +658,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(peer_error_alert, 22)
static const int static_category = alert::peer_notification;
static constexpr alert_category_t static_category = alert::peer_notification;
virtual std::string message() const override;
// a 0-terminated string of the low-level operation that failed, or nullptr if
@ -682,7 +683,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(peer_connect_alert, 23)
static const int static_category = alert::debug_notification;
static constexpr alert_category_t static_category = alert::debug_notification;
virtual std::string message() const override;
int const socket_type;
@ -700,7 +701,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(peer_disconnected_alert, 24)
static const int static_category = alert::debug_notification;
static constexpr alert_category_t static_category = alert::debug_notification;
virtual std::string message() const override;
// the kind of socket this peer was connected over
@ -763,7 +764,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(torrent_finished_alert, 26)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
};
@ -778,7 +779,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(piece_finished_alert, 27)
static const int static_category = alert::progress_notification;
static constexpr alert_category_t static_category = alert::progress_notification;
virtual std::string message() const override;
// the index of the piece that finished
@ -795,7 +796,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(request_dropped_alert, 28)
static const int static_category = alert::progress_notification
static constexpr alert_category_t static_category = alert::progress_notification
| alert::peer_notification;
virtual std::string message() const override;
@ -813,7 +814,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(block_timeout_alert, 29)
static const int static_category = alert::progress_notification
static constexpr alert_category_t static_category = alert::progress_notification
| alert::peer_notification;
virtual std::string message() const override;
@ -831,7 +832,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(block_finished_alert, 30)
static const int static_category = alert::progress_notification;
static constexpr alert_category_t static_category = alert::progress_notification;
virtual std::string message() const override;
int const block_index;
@ -848,7 +849,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(block_downloading_alert, 31)
static const int static_category = alert::progress_notification;
static constexpr alert_category_t static_category = alert::progress_notification;
virtual std::string message() const override;
int const block_index;
@ -887,7 +888,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(storage_moved_alert, 33)
static const int static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert::storage_notification;
virtual std::string message() const override;
// the path the torrent was moved to
@ -912,7 +913,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(storage_moved_failed_alert, 34)
static const int static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert::storage_notification;
virtual std::string message() const override;
error_code const error;
@ -949,7 +950,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(torrent_deleted_alert, 35)
static const int static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert::storage_notification;
virtual std::string message() const override;
sha1_hash info_hash;
@ -965,7 +966,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(torrent_delete_failed_alert, 36)
static const int static_category = alert::storage_notification
static constexpr alert_category_t static_category = alert::storage_notification
| alert::error_notification;
virtual std::string message() const override;
@ -991,7 +992,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(save_resume_data_alert, 37)
static const int static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert::storage_notification;
virtual std::string message() const override;
// the ``params`` structure is populated with the fields to be passed to
@ -1015,7 +1016,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(save_resume_data_failed_alert, 38)
static const int static_category = alert::storage_notification
static constexpr alert_category_t static_category = alert::storage_notification
| alert::error_notification;
virtual std::string message() const override;
@ -1037,7 +1038,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(torrent_paused_alert, 39)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
};
@ -1050,7 +1051,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(torrent_resumed_alert, 40)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
};
@ -1063,7 +1064,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(torrent_checked_alert, 41)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
};
@ -1078,7 +1079,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(url_seed_alert, 42)
static const int static_category = alert::peer_notification | alert::error_notification;
static constexpr alert_category_t static_category = alert::peer_notification | alert::error_notification;
virtual std::string message() const override;
// the error the web seed encountered. If this is not set, the server
@ -1116,7 +1117,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(file_error_alert, 43)
static const int static_category = alert::status_notification
static constexpr alert_category_t static_category = alert::status_notification
| alert::error_notification
| alert::storage_notification;
virtual std::string message() const override;
@ -1153,7 +1154,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(metadata_failed_alert, 44)
static const int static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert::error_notification;
virtual std::string message() const override;
// indicates what failed when parsing the metadata. This error is
@ -1193,7 +1194,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(metadata_received_alert, 45)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
};
@ -1210,7 +1211,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(udp_error_alert, 46)
static const int static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert::error_notification;
virtual std::string message() const override;
// the source address associated with the error (if any)
@ -1231,7 +1232,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(external_ip_alert, 47)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
// the IP address that is believed to be our external IP
@ -1282,7 +1283,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(listen_failed_alert, 48)
static const int static_category = alert::status_notification | alert::error_notification;
static constexpr alert_category_t static_category = alert::status_notification | alert::error_notification;
virtual std::string message() const override;
// the network device libtorrent attempted to listen on, or the IP address
@ -1358,7 +1359,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(listen_succeeded_alert, 49)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
// the address libtorrent ended up listening on. This address
@ -1395,7 +1396,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(portmap_error_alert, 50)
static const int static_category = alert::port_mapping_notification
static constexpr alert_category_t static_category = alert::port_mapping_notification
| alert::error_notification;
virtual std::string message() const override;
@ -1424,7 +1425,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(portmap_alert, 51)
static const int static_category = alert::port_mapping_notification;
static constexpr alert_category_t static_category = alert::port_mapping_notification;
virtual std::string message() const override;
// refers to the mapping index of the port map that failed, i.e.
@ -1460,7 +1461,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(portmap_log_alert, 52)
static const int static_category = alert::port_mapping_log_notification;
static constexpr alert_category_t static_category = alert::port_mapping_log_notification;
virtual std::string message() const override;
int const map_type;
@ -1492,7 +1493,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(fastresume_rejected_alert, 53)
static const int static_category = alert::status_notification
static constexpr alert_category_t static_category = alert::status_notification
| alert::error_notification;
virtual std::string message() const override;
@ -1534,7 +1535,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(peer_blocked_alert, 54)
static const int static_category = alert::ip_block_notification;
static constexpr alert_category_t static_category = alert::ip_block_notification;
virtual std::string message() const override;
enum reason_t
@ -1563,7 +1564,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(dht_announce_alert, 55)
static const int static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert::dht_notification;
virtual std::string message() const override;
aux::noexcept_movable<address> ip;
@ -1580,7 +1581,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(dht_get_peers_alert, 56)
static const int static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert::dht_notification;
virtual std::string message() const override;
sha1_hash info_hash;
@ -1599,7 +1600,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(stats_alert, 57)
static const int static_category = alert::stats_notification;
static constexpr alert_category_t static_category = alert::stats_notification;
virtual std::string message() const override;
enum stats_channel
@ -1650,7 +1651,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(cache_flushed_alert, 58)
static const int static_category = alert::storage_notification;
static constexpr alert_category_t static_category = alert::storage_notification;
};
// This alert is posted when a bittorrent feature is blocked because of the
@ -1665,7 +1666,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(anonymous_mode_alert, 59)
static const int static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert::error_notification;
virtual std::string message() const override;
enum kind_t
@ -1691,7 +1692,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(lsd_peer_alert, 60)
static const int static_category = alert::peer_notification;
static constexpr alert_category_t static_category = alert::peer_notification;
virtual std::string message() const override;
};
@ -1706,7 +1707,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(trackerid_alert, 61)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
// The tracker ID returned by the tracker
@ -1729,7 +1730,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(dht_bootstrap_alert, 62)
static const int static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert::dht_notification;
virtual std::string message() const override;
};
@ -1742,7 +1743,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(torrent_error_alert, 64)
static const int static_category = alert::error_notification | alert::status_notification;
static constexpr alert_category_t static_category = alert::error_notification | alert::status_notification;
virtual std::string message() const override;
// specifies which error the torrent encountered.
@ -1773,7 +1774,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(torrent_need_cert_alert, 65)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
error_code const error;
@ -1793,7 +1794,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(incoming_connection_alert, 66)
static const int static_category = alert::peer_notification;
static constexpr alert_category_t static_category = alert::peer_notification;
virtual std::string message() const override;
// tells you what kind of socket the connection was accepted
@ -1833,7 +1834,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(add_torrent_alert, 67)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
// a copy of the parameters used when adding the torrent, it can be used
@ -1856,7 +1857,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(state_update_alert, 68)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
// contains the torrent status of all torrents that changed since last
@ -1883,7 +1884,7 @@ namespace libtorrent {
, error_code const& ec);
TORRENT_DEFINE_ALERT(mmap_cache_alert, 69)
static const int static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert::error_notification;
virtual std::string message() const override;
error_code const error;
@ -1923,7 +1924,7 @@ namespace libtorrent {
#endif
#endif
static const int static_category = alert::stats_notification;
static constexpr alert_category_t static_category = alert::stats_notification;
virtual std::string message() const override;
// An array are a mix of *counters* and *gauges*, which meanings can be
@ -1972,7 +1973,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(torrent_update_alert, 71)
static const int static_category = alert::status_notification;
static constexpr alert_category_t static_category = alert::status_notification;
virtual std::string message() const override;
// ``old_ih`` and ``new_ih`` are the previous and new info-hash for the torrent, respectively.
@ -1997,7 +1998,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(dht_error_alert, 73)
static const int static_category = alert::error_notification | alert::dht_notification;
static constexpr alert_category_t static_category = alert::error_notification | alert::dht_notification;
virtual std::string message() const override;
// the error code
@ -2027,7 +2028,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(dht_immutable_item_alert, 74)
static const int static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert::dht_notification;
virtual std::string message() const override;
@ -2049,7 +2050,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT_PRIO(dht_mutable_item_alert, 75)
static const int static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert::dht_notification;
virtual std::string message() const override;
// the public key that was looked up
@ -2090,7 +2091,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(dht_put_alert, 76)
static const int static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert::dht_notification;
virtual std::string message() const override;
// the target hash the item was stored under if this was an *immutable*
@ -2118,7 +2119,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(i2p_alert, 77)
static const int static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert::error_notification;
virtual std::string message() const override;
// the error that occurred in the i2p SAM connection
@ -2136,7 +2137,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(dht_outgoing_get_peers_alert, 78)
static const int static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert::dht_notification;
virtual std::string message() const override;
// the info_hash of the torrent we're looking for peers for.
@ -2167,7 +2168,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(log_alert, 79)
static const int static_category = alert::session_log_notification;
static constexpr alert_category_t static_category = alert::session_log_notification;
virtual std::string message() const override;
// returns the log message
@ -2196,7 +2197,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(torrent_log_alert, 80)
static const int static_category = alert::torrent_log_notification;
static constexpr alert_category_t static_category = alert::torrent_log_notification;
virtual std::string message() const override;
// returns the log message
@ -2237,7 +2238,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(peer_log_alert, 81)
static const int static_category = alert::peer_log_notification;
static constexpr alert_category_t static_category = alert::peer_log_notification;
virtual std::string message() const override;
// string literal indicating the kind of event. For messages, this is the
@ -2268,7 +2269,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(lsd_error_alert, 82)
static const int static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert::error_notification;
virtual std::string message() const override;
// The error code
@ -2345,7 +2346,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(dht_stats_alert, 83)
static const int static_category = alert::stats_notification;
static constexpr alert_category_t static_category = alert::stats_notification;
virtual std::string message() const override;
// a vector of the currently running DHT lookups.
@ -2367,7 +2368,7 @@ namespace libtorrent {
, peer_request r, torrent_handle h
, tcp::endpoint const& ep, peer_id const& peer_id);
static const int static_category = alert::incoming_request_notification;
static constexpr alert_category_t static_category = alert::incoming_request_notification;
TORRENT_DEFINE_ALERT(incoming_request_alert, 84)
virtual std::string message() const override;
@ -2390,7 +2391,7 @@ namespace libtorrent {
dht_log_alert(aux::stack_allocator& alloc
, dht_module_t m, char const* fmt, va_list v);
static const int static_category = alert::dht_log_notification;
static constexpr alert_category_t static_category = alert::dht_log_notification;
TORRENT_DEFINE_ALERT(dht_log_alert, 85)
virtual std::string message() const override;
@ -2417,7 +2418,7 @@ namespace libtorrent {
dht_pkt_alert(aux::stack_allocator& alloc, span<char const> buf
, dht_pkt_alert::direction_t d, udp::endpoint const& ep);
static const int static_category = alert::dht_log_notification;
static constexpr alert_category_t static_category = alert::dht_log_notification;
TORRENT_DEFINE_ALERT(dht_pkt_alert, 86)
virtual std::string message() const override;
@ -2452,7 +2453,7 @@ namespace libtorrent {
, sha1_hash const& ih
, std::vector<tcp::endpoint> const& v);
static const int static_category = alert::dht_operation_notification;
static constexpr alert_category_t static_category = alert::dht_operation_notification;
TORRENT_DEFINE_ALERT(dht_get_peers_reply_alert, 87)
virtual std::string message() const override;
@ -2488,7 +2489,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(dht_direct_response_alert, 88)
static const int static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert::dht_notification;
virtual std::string message() const override;
void const* userdata;
@ -2522,7 +2523,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(picker_log_alert, 89)
static const int static_category = alert::picker_log_notification;
static constexpr alert_category_t static_category = alert::picker_log_notification;
virtual std::string message() const override;
static constexpr picker_flags_t partial_ratio{0x1};
@ -2563,7 +2564,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(session_error_alert, 90)
static const int static_category = alert::error_notification;
static constexpr alert_category_t static_category = alert::error_notification;
std::string message() const override;
// The error code, if one is associated with this error
@ -2582,7 +2583,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(dht_live_nodes_alert, 91)
static const int static_category = alert::dht_notification;
static constexpr alert_category_t static_category = alert::dht_notification;
virtual std::string message() const override;
sha1_hash node_id;
@ -2612,7 +2613,7 @@ namespace libtorrent {
explicit session_stats_header_alert(aux::stack_allocator& alloc);
TORRENT_DEFINE_ALERT(session_stats_header_alert, 92)
static const int static_category = alert::stats_notification;
static constexpr alert_category_t static_category = alert::stats_notification;
virtual std::string message() const override;
};
@ -2625,7 +2626,7 @@ namespace libtorrent {
, std::vector<sha1_hash> const& samples
, std::vector<std::pair<sha1_hash, udp::endpoint>> const& nodes);
static const int static_category = alert::dht_operation_notification;
static constexpr alert_category_t static_category = alert::dht_operation_notification;
TORRENT_DEFINE_ALERT(dht_sample_infohashes_alert, 93)
virtual std::string message() const override;
@ -2675,7 +2676,7 @@ namespace libtorrent {
TORRENT_DEFINE_ALERT(block_uploaded_alert, 94)
static const int static_category = alert::progress_notification;
static constexpr alert_category_t static_category = alert::progress_notification;
virtual std::string message() const override;
int const block_index;

View File

@ -35,6 +35,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/entry.hpp"
#include "libtorrent/string_view.hpp"
#include "libtorrent/flags.hpp"
#include <vector>
#include <memory>
@ -94,6 +95,9 @@ namespace libtorrent {
void set_int(int name, int val);
void set_bool(int name, bool val);
bool has_val(int name) const;
template <typename Type, typename Tag>
void set_int(int name, flags::bitfield_flag<Type, Tag> const val)
{ set_int(name, static_cast<int>(static_cast<Type>(val))); }
// clear the settings pack from all settings
void clear();

View File

@ -55,6 +55,31 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
constexpr alert_category_t alert::error_notification;
constexpr alert_category_t alert::peer_notification;
constexpr alert_category_t alert::port_mapping_notification;
constexpr alert_category_t alert::storage_notification;
constexpr alert_category_t alert::tracker_notification;
constexpr alert_category_t alert::debug_notification;
constexpr alert_category_t alert::status_notification;
constexpr alert_category_t alert::progress_notification;
constexpr alert_category_t alert::ip_block_notification;
constexpr alert_category_t alert::performance_warning;
constexpr alert_category_t alert::dht_notification;
constexpr alert_category_t alert::stats_notification;
constexpr alert_category_t alert::session_log_notification;
constexpr alert_category_t alert::torrent_log_notification;
constexpr alert_category_t alert::peer_log_notification;
constexpr alert_category_t alert::incoming_request_notification;
constexpr alert_category_t alert::dht_log_notification;
constexpr alert_category_t alert::dht_operation_notification;
constexpr alert_category_t alert::port_mapping_log_notification;
constexpr alert_category_t alert::picker_log_notification;
constexpr alert_category_t alert::all_categories;
#ifndef TORRENT_NO_DEPRECATE
constexpr alert_category_t alert::alert::rss_notification;
#endif
alert::alert() : m_timestamp(clock_type::now()) {}
alert::~alert() = default;
time_point alert::timestamp() const { return m_timestamp; }
@ -2449,4 +2474,92 @@ namespace {
return ret;
}
// this will no longer be necessary in C++17
constexpr alert_category_t peer_alert::static_category;
constexpr alert_category_t tracker_alert::static_category;
constexpr alert_category_t torrent_removed_alert::static_category;
constexpr alert_category_t read_piece_alert::static_category;
constexpr alert_category_t file_completed_alert::static_category;
constexpr alert_category_t file_renamed_alert::static_category;
constexpr alert_category_t file_rename_failed_alert::static_category;
constexpr alert_category_t performance_alert::static_category;
constexpr alert_category_t state_changed_alert::static_category;
constexpr alert_category_t tracker_error_alert::static_category;
constexpr alert_category_t tracker_warning_alert::static_category;
constexpr alert_category_t scrape_failed_alert::static_category;
constexpr alert_category_t dht_reply_alert::static_category;
constexpr alert_category_t hash_failed_alert::static_category;
constexpr alert_category_t peer_error_alert::static_category;
constexpr alert_category_t peer_connect_alert::static_category;
constexpr alert_category_t peer_disconnected_alert::static_category;
constexpr alert_category_t torrent_finished_alert::static_category;
constexpr alert_category_t piece_finished_alert::static_category;
constexpr alert_category_t request_dropped_alert::static_category;
constexpr alert_category_t block_timeout_alert::static_category;
constexpr alert_category_t block_finished_alert::static_category;
constexpr alert_category_t block_downloading_alert::static_category;
constexpr alert_category_t storage_moved_alert::static_category;
constexpr alert_category_t storage_moved_failed_alert::static_category;
constexpr alert_category_t torrent_deleted_alert::static_category;
constexpr alert_category_t torrent_delete_failed_alert::static_category;
constexpr alert_category_t save_resume_data_alert::static_category;
constexpr alert_category_t save_resume_data_failed_alert::static_category;
constexpr alert_category_t torrent_paused_alert::static_category;
constexpr alert_category_t torrent_resumed_alert::static_category;
constexpr alert_category_t torrent_checked_alert::static_category;
constexpr alert_category_t url_seed_alert::static_category;
constexpr alert_category_t file_error_alert::static_category;
constexpr alert_category_t metadata_failed_alert::static_category;
constexpr alert_category_t metadata_received_alert::static_category;
constexpr alert_category_t udp_error_alert::static_category;
constexpr alert_category_t external_ip_alert::static_category;
constexpr alert_category_t listen_failed_alert::static_category;
constexpr alert_category_t listen_succeeded_alert::static_category;
constexpr alert_category_t portmap_error_alert::static_category;
constexpr alert_category_t portmap_alert::static_category;
constexpr alert_category_t portmap_log_alert::static_category;
constexpr alert_category_t fastresume_rejected_alert::static_category;
constexpr alert_category_t peer_blocked_alert::static_category;
constexpr alert_category_t dht_announce_alert::static_category;
constexpr alert_category_t dht_get_peers_alert::static_category;
constexpr alert_category_t stats_alert::static_category;
constexpr alert_category_t cache_flushed_alert::static_category;
constexpr alert_category_t anonymous_mode_alert::static_category;
constexpr alert_category_t lsd_peer_alert::static_category;
constexpr alert_category_t trackerid_alert::static_category;
constexpr alert_category_t dht_bootstrap_alert::static_category;
constexpr alert_category_t torrent_error_alert::static_category;
constexpr alert_category_t torrent_need_cert_alert::static_category;
constexpr alert_category_t incoming_connection_alert::static_category;
constexpr alert_category_t add_torrent_alert::static_category;
constexpr alert_category_t state_update_alert::static_category;
constexpr alert_category_t session_stats_alert::static_category;
constexpr alert_category_t dht_error_alert::static_category;
constexpr alert_category_t dht_immutable_item_alert::static_category;
constexpr alert_category_t dht_mutable_item_alert::static_category;
constexpr alert_category_t dht_put_alert::static_category;
constexpr alert_category_t i2p_alert::static_category;
constexpr alert_category_t dht_outgoing_get_peers_alert::static_category;
constexpr alert_category_t log_alert::static_category;
constexpr alert_category_t torrent_log_alert::static_category;
constexpr alert_category_t peer_log_alert::static_category;
constexpr alert_category_t lsd_error_alert::static_category;
constexpr alert_category_t dht_stats_alert::static_category;
constexpr alert_category_t incoming_request_alert::static_category;
constexpr alert_category_t dht_log_alert::static_category;
constexpr alert_category_t dht_pkt_alert::static_category;
constexpr alert_category_t dht_get_peers_reply_alert::static_category;
constexpr alert_category_t dht_direct_response_alert::static_category;
constexpr alert_category_t picker_log_alert::static_category;
constexpr alert_category_t session_error_alert::static_category;
constexpr alert_category_t dht_live_nodes_alert::static_category;
constexpr alert_category_t session_stats_header_alert::static_category;
constexpr alert_category_t dht_sample_infohashes_alert::static_category;
constexpr alert_category_t block_uploaded_alert::static_category;
#ifndef TORRENT_NO_DEPRECATE
constexpr alert_category_t mmap_cache_alert::static_category;
constexpr alert_category_t torrent_added_alert::static_category;
constexpr alert_category_t torrent_update_alert::static_category;
#endif
} // namespace libtorrent

View File

@ -40,7 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
alert_manager::alert_manager(int const queue_limit, std::uint32_t const alert_mask)
alert_manager::alert_manager(int const queue_limit, alert_category_t const alert_mask)
: m_alert_mask(alert_mask)
, m_queue_size_limit(queue_limit)
{}

View File

@ -539,7 +539,7 @@ namespace aux {
{
if (pack.has_val(settings_pack::alert_mask))
{
m_alerts.set_alert_mask(std::uint32_t(pack.get_int(settings_pack::alert_mask)));
m_alerts.set_alert_mask(alert_category_t(std::uint32_t(pack.get_int(settings_pack::alert_mask))));
}
#ifndef TORRENT_DISABLE_LOGGING
@ -6492,7 +6492,7 @@ namespace {
void session_impl::update_alert_mask()
{
m_alerts.set_alert_mask(std::uint32_t(m_settings.get_int(settings_pack::alert_mask)));
m_alerts.set_alert_mask(alert_category_t(std::uint32_t(m_settings.get_int(settings_pack::alert_mask))));
}
void session_impl::pop_alerts(std::vector<alert*>* alerts)

View File

@ -321,7 +321,7 @@ constexpr int CLOSE_FILE_INTERVAL = 0;
SET(connect_seed_every_n_download, 10, nullptr),
SET(max_http_recv_buffer_size, 4*1024*204, nullptr),
SET(max_retry_port_bind, 10, nullptr),
SET(alert_mask, alert::error_notification, &session_impl::update_alert_mask),
SET(alert_mask, int(static_cast<std::uint32_t>(alert::error_notification)), &session_impl::update_alert_mask),
SET(out_enc_policy, settings_pack::pe_enabled, nullptr),
SET(in_enc_policy, settings_pack::pe_enabled, nullptr),
SET(allowed_enc_level, settings_pack::pe_both, nullptr),

View File

@ -38,7 +38,7 @@ using namespace lt;
lt::settings_pack settings()
{
const int mask = alert::all_categories
auto const mask = alert::all_categories
& ~(alert::progress_notification
| alert::performance_warning
| alert::stats_notification

View File

@ -75,7 +75,7 @@ void test_swarm(test_flags_t const flags)
session_proxy p2;
session_proxy p3;
const int mask = alert::all_categories
auto const mask = alert::all_categories
& ~(alert::progress_notification
| alert::performance_warning
| alert::stats_notification);

View File

@ -44,7 +44,7 @@ using namespace lt;
TORRENT_TEST(limit)
{
alert_manager mgr(500, 0xffffffff);
alert_manager mgr(500, alert::all_categories);
TEST_EQUAL(mgr.alert_queue_size_limit(), 500);
TEST_EQUAL(mgr.pending(), false);
@ -80,7 +80,7 @@ TORRENT_TEST(limit)
TORRENT_TEST(priority_limit)
{
alert_manager mgr(100, 0xffffffff);
alert_manager mgr(100, alert::all_categories);
TEST_EQUAL(mgr.alert_queue_size_limit(), 100);
@ -108,7 +108,7 @@ void test_notify_fun(int& cnt)
TORRENT_TEST(notify_function)
{
int cnt = 0;
alert_manager mgr(100, 0xffffffff);
alert_manager mgr(100, alert::all_categories);
TEST_EQUAL(mgr.alert_queue_size_limit(), 100);
TEST_EQUAL(mgr.pending(), false);
@ -166,7 +166,7 @@ TORRENT_TEST(extensions)
{
#ifndef TORRENT_DISABLE_EXTENSIONS
memset(plugin_alerts, 0, sizeof(plugin_alerts));
alert_manager mgr(100, 0xffffffff);
alert_manager mgr(100, alert::all_categories);
mgr.add_extension(std::make_shared<test_plugin>(0));
mgr.add_extension(std::make_shared<test_plugin>(1));
@ -196,7 +196,7 @@ void post_torrent_added(alert_manager* mgr)
TORRENT_TEST(wait_for_alert)
{
alert_manager mgr(100, 0xffffffff);
alert_manager mgr(100, alert::all_categories);
time_point start = clock_type::now();
@ -237,12 +237,12 @@ TORRENT_TEST(wait_for_alert)
TORRENT_TEST(alert_mask)
{
alert_manager mgr(100, 0xffffffff);
alert_manager mgr(100, alert::all_categories);
TEST_CHECK(mgr.should_post<add_torrent_alert>());
TEST_CHECK(mgr.should_post<torrent_paused_alert>());
mgr.set_alert_mask(0);
mgr.set_alert_mask({});
TEST_CHECK(!mgr.should_post<add_torrent_alert>());
TEST_CHECK(!mgr.should_post<torrent_paused_alert>());

View File

@ -75,7 +75,7 @@ TORRENT_TEST(alerts_types)
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(tracker_reply_alert, 15, 0, alert::tracker_notification);
TEST_ALERT_TYPE(dht_reply_alert, 16, 0, alert::tracker_notification);
TEST_ALERT_TYPE(dht_reply_alert, 16, 0, alert::dht_notification | alert::tracker_notification);
TEST_ALERT_TYPE(tracker_announce_alert, 17, 0, alert::tracker_notification);
TEST_ALERT_TYPE(hash_failed_alert, 18, 0, alert::status_notification);
TEST_ALERT_TYPE(peer_ban_alert, 19, 0, alert::peer_notification);

View File

@ -176,7 +176,7 @@ void test_checking(int flags = read_only_files)
}
}
int mask = alert::all_categories
auto const mask = alert::all_categories
& ~(alert::progress_notification
| alert::performance_warning
| alert::stats_notification);

View File

@ -57,7 +57,7 @@ void test_pex()
session_proxy p2;
session_proxy p3;
int mask = alert::all_categories
auto const mask = alert::all_categories
& ~(alert::progress_notification
| alert::performance_warning
| alert::stats_notification);

View File

@ -51,7 +51,7 @@ POSSIBILITY OF SUCH DAMAGE.
using namespace lt;
using std::ignore;
const int mask = alert::all_categories & ~(alert::performance_warning | alert::stats_notification);
alert_category_t const mask = alert::all_categories & ~(alert::performance_warning | alert::stats_notification);
int peer_disconnects = 0;

View File

@ -99,7 +99,7 @@ session_proxy test_proxy(settings_pack::proxy_type_t proxy_type, int flags)
int prev_udp_announces = num_udp_announces();
int const alert_mask = alert::all_categories
auto const alert_mask = alert::all_categories
& ~alert::progress_notification
& ~alert::stats_notification;

View File

@ -89,7 +89,7 @@ void test_read_piece(int flags)
std::printf("generated torrent: %s tmp1_read_piece/test_torrent\n"
, aux::to_hex(ti->info_hash()).c_str());
const int mask = alert::all_categories
auto const mask = alert::all_categories
& ~(alert::progress_notification
| alert::performance_warning
| alert::stats_notification);

View File

@ -49,7 +49,7 @@ POSSIBILITY OF SUCH DAMAGE.
using namespace lt;
const int mask = alert::all_categories & ~(alert::performance_warning | alert::stats_notification);
auto const mask = alert::all_categories & ~(alert::performance_warning | alert::stats_notification);
void wait_for_complete(lt::session& ses, torrent_handle h)
{

View File

@ -74,7 +74,7 @@ void test_remap_files(storage_mode_t storage_mode = storage_mode_sparse)
t->remap_files(fs);
int const alert_mask = alert::all_categories
auto const alert_mask = alert::all_categories
& ~alert::stats_notification;
session_proxy p1;

View File

@ -769,7 +769,7 @@ TORRENT_TEST(rename_file)
file_storage fs;
std::shared_ptr<torrent_info> info = setup_torrent_info(fs, buf);
const int mask = alert::all_categories
auto const mask = alert::all_categories
& ~(alert::performance_warning
| alert::stats_notification);

View File

@ -53,7 +53,8 @@ using namespace lt;
using std::ignore;
const int mask = alert::all_categories & ~(alert::performance_warning | alert::stats_notification);
auto const mask = alert::all_categories
& ~(alert::performance_warning | alert::stats_notification);
int peer_disconnects = 0;

View File

@ -60,7 +60,7 @@ void test_transfer()
session_proxy p1;
session_proxy p2;
const int mask = alert::all_categories
auto const mask = alert::all_categories
& ~(alert::progress_notification
| alert::performance_warning
| alert::stats_notification);

View File

@ -393,7 +393,7 @@ int EXPORT run_http_suite(int proxy, char const* protocol, bool test_url_seed
}
{
const int mask = alert::all_categories
auto const mask = alert::all_categories
& ~(alert::progress_notification
| alert::performance_warning
| alert::stats_notification);