diff --git a/bindings/python/src/alert.cpp b/bindings/python/src/alert.cpp index 4f05b4e98..5a5775ebe 100644 --- a/bindings/python/src/alert.cpp +++ b/bindings/python/src/alert.cpp @@ -163,6 +163,107 @@ dict session_stats_values(session_stats_alert const& alert) return d; } +namespace boost +{ + // some older compilers (like msvc-12.0) end up using + // boost::is_polymorphic inside boost.python applied + // to alert types. This is problematic, since it appears + // to be implemented by deriving from the type, which + // yields a compiler error since most alerts are final. + // this just short-cuts the query to say that all these + // types are indeed polymorphic, no need to derive from + // them. +#define POLY(x) template<> \ + struct is_polymorphic : boost::mpl::true_ {}; + + POLY(torrent_alert) + POLY(tracker_alert) + POLY(torrent_added_alert) + POLY(torrent_removed_alert) + POLY(read_piece_alert) + POLY(peer_alert) + POLY(tracker_error_alert) + POLY(tracker_warning_alert) + POLY(tracker_reply_alert) + POLY(tracker_announce_alert) + POLY(hash_failed_alert) + POLY(peer_ban_alert) + POLY(peer_error_alert) + POLY(invalid_request_alert) + POLY(torrent_error_alert) + POLY(torrent_finished_alert) + POLY(piece_finished_alert) + POLY(block_finished_alert) + POLY(block_downloading_alert) + POLY(storage_moved_alert) + POLY(storage_moved_failed_alert) + POLY(torrent_deleted_alert) + POLY(torrent_paused_alert) + POLY(torrent_checked_alert) + POLY(url_seed_alert) + POLY(file_error_alert) + POLY(metadata_failed_alert) + POLY(metadata_received_alert) + POLY(listen_failed_alert) + POLY(listen_succeeded_alert) + POLY(portmap_error_alert) + POLY(portmap_alert) + POLY(fastresume_rejected_alert) + POLY(peer_blocked_alert) + POLY(scrape_reply_alert) + POLY(scrape_failed_alert) + POLY(udp_error_alert) + POLY(external_ip_alert) + POLY(save_resume_data_alert) + POLY(file_completed_alert) + POLY(file_renamed_alert) + POLY(file_rename_failed_alert) + POLY(torrent_resumed_alert) + POLY(state_changed_alert) + POLY(state_update_alert) + POLY(i2p_alert) + POLY(dht_reply_alert) + POLY(dht_announce_alert) + POLY(dht_get_peers_alert) + POLY(peer_unsnubbed_alert) + POLY(peer_snubbed_alert) + POLY(peer_connect_alert) + POLY(peer_disconnected_alert) + POLY(request_dropped_alert) + POLY(block_timeout_alert) + POLY(unwanted_block_alert) + POLY(torrent_delete_failed_alert) + POLY(save_resume_data_failed_alert) + POLY(performance_alert) + POLY(stats_alert) + POLY(anonymous_mode_alert) + POLY(incoming_connection_alert) + POLY(torrent_need_cert_alert) + POLY(add_torrent_alert) + POLY(dht_outgoing_get_peers_alert) + POLY(lsd_error_alert) + POLY(dht_stats_alert) + POLY(dht_immutable_item_alert) + POLY(dht_mutable_item_alert) + POLY(dht_put_alert) + POLY(session_stats_alert) + POLY(dht_get_peers_reply_alert) + +#ifndef TORRENT_NO_DEPRECATE + POLY(torrent_update_alert) +#endif + +#ifndef TORRENT_DISABLE_LOGGING + POLY(portmap_log_alert) + POLY(log_alert) + POLY(torrent_log_alert) + POLY(peer_log_alert) + POLY(picker_log_alert) +#endif // TORRENT_DISABLE_LOGGING + +#undef POLY +} + void bind_alert() { using boost::noncopyable; diff --git a/docs/gen_reference_doc.py b/docs/gen_reference_doc.py index de3a40d20..a4f6caece 100644 --- a/docs/gen_reference_doc.py +++ b/docs/gen_reference_doc.py @@ -149,7 +149,6 @@ def is_visible(desc): return True def highlight_signature(s): - s = s.replace('TORRENT_OVERRIDE', 'override').replace('TORRENT_FINAL', 'final') name = s.split('(', 1) name2 = name[0].split(' ') if len(name2[-1]) == 0: return s @@ -274,7 +273,6 @@ def parse_class(lno, lines, filename): state = 'private' class_type = 'class' - decl = decl.replace('TORRENT_FINAL', 'final') name = decl.split(':')[0].replace('class ', '').replace('struct ', '').replace('final', '').strip() diff --git a/include/libtorrent/alert_types.hpp b/include/libtorrent/alert_types.hpp index aa9de690a..2150add15 100644 --- a/include/libtorrent/alert_types.hpp +++ b/include/libtorrent/alert_types.hpp @@ -88,7 +88,7 @@ namespace libtorrent static const int alert_type = 0; // returns the message associated with this alert - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // The torrent_handle pointing to the torrent this // alert is associated with. @@ -116,8 +116,8 @@ namespace libtorrent static const int alert_type = 1; static const int static_category = alert::peer_notification; - virtual int category() const TORRENT_OVERRIDE { return static_category; } - virtual std::string message() const TORRENT_OVERRIDE; + virtual int category() const override { return static_category; } + virtual std::string message() const override; // The peer's IP address and port. tcp::endpoint ip; @@ -137,8 +137,8 @@ namespace libtorrent static const int alert_type = 2; static const int static_category = alert::tracker_notification; - virtual int category() const TORRENT_OVERRIDE { return static_category; } - virtual std::string message() const TORRENT_OVERRIDE; + virtual int category() const override { return static_category; } + virtual std::string message() const override; // returns a null-terminated string of the tracker's URL char const* tracker_url() const; @@ -153,7 +153,7 @@ namespace libtorrent #ifndef TORRENT_NO_DEPRECATE #define TORRENT_CLONE(name) \ - virtual std::auto_ptr clone_impl() const TORRENT_OVERRIDE \ + virtual std::auto_ptr clone_impl() const override \ { return std::auto_ptr(new name(*this)); } #else #define TORRENT_CLONE(name) @@ -180,10 +180,10 @@ namespace libtorrent TORRENT_PROTECTED_CCTOR(name) \ static const int priority = prio; \ static const int alert_type = seq; \ - virtual int type() const TORRENT_OVERRIDE { return alert_type; } \ + virtual int type() const override { return alert_type; } \ TORRENT_CLONE(name) \ - virtual int category() const TORRENT_OVERRIDE { return static_category; } \ - virtual char const* what() const TORRENT_OVERRIDE { return #name; } + virtual int category() const override { return static_category; } \ + virtual char const* what() const override { return #name; } #define TORRENT_DEFINE_ALERT(name, seq) \ TORRENT_DEFINE_ALERT_IMPL(name, seq, 0) @@ -195,14 +195,14 @@ namespace libtorrent // added. It doesn't contain any members of its own, but inherits the torrent handle // from its base class. // It's posted when the ``status_notification`` bit is set in the alert_mask. - struct TORRENT_EXPORT torrent_added_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT torrent_added_alert final : torrent_alert { // internal 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; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; }; // The ``torrent_removed_alert`` is posted whenever a torrent is removed. Since @@ -217,7 +217,7 @@ namespace libtorrent // The ``torrent_handle`` acts as a ``weak_ptr``, even though its object no // longer exists, it can still compare equal to another weak pointer which // points to the same non-existent object. - struct TORRENT_EXPORT torrent_removed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT torrent_removed_alert final : torrent_alert { // internal torrent_removed_alert(aux::stack_allocator& alloc @@ -225,7 +225,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT_PRIO(torrent_removed_alert, 4) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; sha1_hash info_hash; }; @@ -237,7 +237,7 @@ namespace libtorrent // number of bytes that was read. // // If the operation fails, ec will indicate what went wrong. - struct TORRENT_EXPORT read_piece_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT read_piece_alert final : torrent_alert { // internal read_piece_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -247,7 +247,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT_PRIO(read_piece_alert, 5) static const int static_category = alert::storage_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; error_code ec; boost::shared_array buffer; @@ -257,7 +257,7 @@ namespace libtorrent // This is posted whenever an individual file completes its download. i.e. // All pieces overlapping this file have passed their hash check. - struct TORRENT_EXPORT file_completed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT file_completed_alert final : torrent_alert { // internal file_completed_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -266,7 +266,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(file_completed_alert, 6) static const int static_category = alert::progress_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // refers to the index of the file that completed. int index; @@ -274,7 +274,7 @@ namespace libtorrent // This is posted as a response to a torrent_handle::rename_file() call, if the rename // operation succeeds. - struct TORRENT_EXPORT file_renamed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT file_renamed_alert final : torrent_alert { // internal file_renamed_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -284,7 +284,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT_PRIO(file_renamed_alert, 7) static const int static_category = alert::storage_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; #ifndef TORRENT_NO_DEPRECATE std::string name; #endif @@ -299,7 +299,7 @@ namespace libtorrent // This is posted as a response to a torrent_handle::rename_file() call, if the rename // operation failed. - struct TORRENT_EXPORT file_rename_failed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT file_rename_failed_alert final : torrent_alert { // internal file_rename_failed_alert(aux::stack_allocator& alloc @@ -310,7 +310,7 @@ namespace libtorrent static const int static_category = alert::storage_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // refers to the index of the file that was supposed to be renamed, // ``error`` is the error code returned from the filesystem. @@ -320,7 +320,7 @@ namespace libtorrent // This alert is generated when a limit is reached that might have a negative impact on // upload or download rate performance. - struct TORRENT_EXPORT performance_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT performance_alert final : torrent_alert { enum performance_warning_t { @@ -411,13 +411,13 @@ namespace libtorrent static const int static_category = alert::performance_warning; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; performance_warning_t warning_code; }; // Generated whenever a torrent changes its state. - struct TORRENT_EXPORT state_changed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT state_changed_alert final : torrent_alert { // internal state_changed_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -428,7 +428,7 @@ namespace libtorrent static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the new state of the torrent. torrent_status::state_t state; @@ -445,7 +445,7 @@ namespace libtorrent // failed. ``status_code`` is the code returned from the HTTP server. 401 // means the tracker needs authentication, 404 means not found etc. If the // tracker timed out, the code will be set to 0. - struct TORRENT_EXPORT tracker_error_alert TORRENT_FINAL : tracker_alert + struct TORRENT_EXPORT tracker_error_alert final : tracker_alert { // internal tracker_error_alert(aux::stack_allocator& alloc @@ -459,7 +459,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(tracker_error_alert, 11) static const int static_category = alert::tracker_notification | alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; int times_in_row; int status_code; @@ -478,7 +478,7 @@ namespace libtorrent // This alert is triggered if the tracker reply contains a warning field. // Usually this means that the tracker announce was successful, but the // tracker has a message to the client. - struct TORRENT_EXPORT tracker_warning_alert TORRENT_FINAL : tracker_alert + struct TORRENT_EXPORT tracker_warning_alert final : tracker_alert { // internal tracker_warning_alert(aux::stack_allocator& alloc @@ -489,7 +489,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(tracker_warning_alert, 12) static const int static_category = alert::tracker_notification | alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; #ifndef TORRENT_NO_DEPRECATE // contains the warning message from the tracker. @@ -504,7 +504,7 @@ namespace libtorrent }; // This alert is generated when a scrape request succeeds. - struct TORRENT_EXPORT scrape_reply_alert TORRENT_FINAL : tracker_alert + struct TORRENT_EXPORT scrape_reply_alert final : tracker_alert { // internal scrape_reply_alert(aux::stack_allocator& alloc @@ -515,7 +515,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(scrape_reply_alert, 13) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the data returned in the scrape response. These numbers // may be -1 if the response was malformed. @@ -526,7 +526,7 @@ namespace libtorrent // If a scrape request fails, this alert is generated. This might be due // to the tracker timing out, refusing connection or returning an http response // code indicating an error. - struct TORRENT_EXPORT scrape_failed_alert TORRENT_FINAL : tracker_alert + struct TORRENT_EXPORT scrape_failed_alert final : tracker_alert { // internal scrape_failed_alert(aux::stack_allocator& alloc @@ -541,7 +541,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(scrape_failed_alert, 14) static const int static_category = alert::tracker_notification | alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; #ifndef TORRENT_NO_DEPRECATE // contains a message describing the error. @@ -564,7 +564,7 @@ namespace libtorrent // This alert is only for informational purpose. It is generated when a tracker announce // succeeds. It is generated regardless what kind of tracker was used, be it UDP, HTTP or // the DHT. - struct TORRENT_EXPORT tracker_reply_alert TORRENT_FINAL : tracker_alert + struct TORRENT_EXPORT tracker_reply_alert final : tracker_alert { // internal tracker_reply_alert(aux::stack_allocator& alloc @@ -574,7 +574,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(tracker_reply_alert, 15) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // tells how many peers the tracker returned in this response. This is // not expected to be more thant the ``num_want`` settings. These are not necessarily @@ -586,7 +586,7 @@ namespace libtorrent // is the number of peers we received in this packet. Typically these packets are // received from multiple DHT nodes, and so the alerts are typically generated // a few at a time. - struct TORRENT_EXPORT dht_reply_alert TORRENT_FINAL : tracker_alert + struct TORRENT_EXPORT dht_reply_alert final : tracker_alert { // internal dht_reply_alert(aux::stack_allocator& alloc @@ -595,7 +595,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_reply_alert, 16) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; int num_peers; }; @@ -603,7 +603,7 @@ namespace libtorrent // This alert is generated each time a tracker announce is sent (or attempted to be sent). // There are no extra data members in this alert. The url can be found in the base class // however. - struct TORRENT_EXPORT tracker_announce_alert TORRENT_FINAL : tracker_alert + struct TORRENT_EXPORT tracker_announce_alert final : tracker_alert { // internal tracker_announce_alert(aux::stack_allocator& alloc @@ -612,7 +612,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(tracker_announce_alert, 17) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // specifies what event was sent to the tracker. It is defined as: // @@ -625,7 +625,7 @@ namespace libtorrent // This alert is generated when a finished piece fails its hash check. You can get the handle // to the torrent which got the failed piece and the index of the piece itself from the alert. - struct TORRENT_EXPORT hash_failed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT hash_failed_alert final : torrent_alert { // internal hash_failed_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -634,14 +634,14 @@ namespace libtorrent TORRENT_DEFINE_ALERT(hash_failed_alert, 18) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; int piece_index; }; // This alert is generated when a peer is banned because it has sent too many corrupt pieces // to us. ``ip`` is the endpoint to the peer that was banned. - struct TORRENT_EXPORT peer_ban_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT peer_ban_alert final : peer_alert { // internal peer_ban_alert(aux::stack_allocator& alloc, torrent_handle h @@ -649,12 +649,12 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_ban_alert, 19) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; }; // This alert is generated when a peer is unsnubbed. Essentially when it was snubbed for stalling // sending data, and now it started sending data again. - struct TORRENT_EXPORT peer_unsnubbed_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT peer_unsnubbed_alert final : peer_alert { // internal peer_unsnubbed_alert(aux::stack_allocator& alloc, torrent_handle h @@ -662,12 +662,12 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_unsnubbed_alert, 20) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; }; // This alert is generated when a peer is snubbed, when it stops sending data when we request // it. - struct TORRENT_EXPORT peer_snubbed_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT peer_snubbed_alert final : peer_alert { // internal peer_snubbed_alert(aux::stack_allocator& alloc, torrent_handle h @@ -675,12 +675,12 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_snubbed_alert, 21) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; }; // This alert is generated when a peer sends invalid data over the peer-peer protocol. The peer // will be disconnected, but you get its ip address from the alert, to identify it. - struct TORRENT_EXPORT peer_error_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT peer_error_alert final : peer_alert { // internal peer_error_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -690,7 +690,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_error_alert, 22) static const int static_category = alert::peer_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // a NULL-terminated string of the low-level operation that failed, or NULL if // there was no low level disk operation. @@ -705,7 +705,7 @@ namespace libtorrent }; // This alert is posted every time an outgoing peer connect attempts succeeds. - struct TORRENT_EXPORT peer_connect_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT peer_connect_alert final : peer_alert { // internal peer_connect_alert(aux::stack_allocator& alloc, torrent_handle h @@ -714,14 +714,14 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_connect_alert, 23) static const int static_category = alert::debug_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; int socket_type; }; // This alert is generated when a peer is disconnected for any reason (other than the ones // covered by peer_error_alert ). - struct TORRENT_EXPORT peer_disconnected_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT peer_disconnected_alert final : peer_alert { // internal peer_disconnected_alert(aux::stack_allocator& alloc @@ -732,7 +732,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_disconnected_alert, 24) static const int static_category = alert::debug_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the kind of socket this peer was connected over int socket_type; @@ -755,7 +755,7 @@ namespace libtorrent // This is a debug alert that is generated by an incoming invalid piece request. // ``ip`` is the address of the peer and the ``request`` is the actual incoming // request from the peer. See peer_request for more info. - struct TORRENT_EXPORT invalid_request_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT invalid_request_alert final : peer_alert { // internal invalid_request_alert(aux::stack_allocator& alloc @@ -765,7 +765,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(invalid_request_alert, 25) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the request we received from the peer peer_request request; @@ -785,7 +785,7 @@ namespace libtorrent // This alert is generated when a torrent switches from being a downloader to a seed. // It will only be generated once per torrent. It contains a torrent_handle to the // torrent in question. - struct TORRENT_EXPORT torrent_finished_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT torrent_finished_alert final : torrent_alert { // internal torrent_finished_alert(aux::stack_allocator& alloc, @@ -794,13 +794,13 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_finished_alert, 26) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; }; // this alert is posted every time a piece completes downloading // and passes the hash check. This alert derives from torrent_alert // which contains the torrent_handle to the torrent the piece belongs to. - struct TORRENT_EXPORT piece_finished_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT piece_finished_alert final : torrent_alert { // internal piece_finished_alert(aux::stack_allocator& alloc, @@ -809,14 +809,14 @@ namespace libtorrent TORRENT_DEFINE_ALERT(piece_finished_alert, 27) static const int static_category = alert::progress_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the index of the piece that finished int piece_index; }; // This alert is generated when a peer rejects or ignores a piece request. - struct TORRENT_EXPORT request_dropped_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT request_dropped_alert final : peer_alert { // internal request_dropped_alert(aux::stack_allocator& alloc, torrent_handle h @@ -827,14 +827,14 @@ namespace libtorrent static const int static_category = alert::progress_notification | alert::peer_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; int block_index; int piece_index; }; // This alert is generated when a block request times out. - struct TORRENT_EXPORT block_timeout_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT block_timeout_alert final : peer_alert { // internal block_timeout_alert(aux::stack_allocator& alloc, torrent_handle h @@ -845,14 +845,14 @@ namespace libtorrent static const int static_category = alert::progress_notification | alert::peer_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; int block_index; int piece_index; }; // This alert is generated when a block request receives a response. - struct TORRENT_EXPORT block_finished_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT block_finished_alert final : peer_alert { // internal block_finished_alert(aux::stack_allocator& alloc, torrent_handle h @@ -862,14 +862,14 @@ namespace libtorrent TORRENT_DEFINE_ALERT(block_finished_alert, 30) static const int static_category = alert::progress_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; int block_index; int piece_index; }; // This alert is generated when a block request is sent to a peer. - struct TORRENT_EXPORT block_downloading_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT block_downloading_alert final : peer_alert { // internal block_downloading_alert(aux::stack_allocator& alloc, torrent_handle h @@ -879,7 +879,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(block_downloading_alert, 31) static const int static_category = alert::progress_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; #ifndef TORRENT_NO_DEPRECATE char const* peer_speedmsg; @@ -890,7 +890,7 @@ namespace libtorrent // This alert is generated when a block is received that was not requested or // whose request timed out. - struct TORRENT_EXPORT unwanted_block_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT unwanted_block_alert final : peer_alert { // internal unwanted_block_alert(aux::stack_allocator& alloc, torrent_handle h @@ -899,7 +899,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(unwanted_block_alert, 32) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; int block_index; int piece_index; @@ -909,7 +909,7 @@ namespace libtorrent // files have been moved, as an effect of a call to ``torrent_handle::move_storage``. This // is useful to synchronize with the actual disk. The ``path`` member is the new path of // the storage. - struct TORRENT_EXPORT storage_moved_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT storage_moved_alert final : torrent_alert { // internal storage_moved_alert(aux::stack_allocator& alloc @@ -918,7 +918,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(storage_moved_alert, 33) static const int static_category = alert::storage_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; #ifndef TORRENT_NO_DEPRECATE std::string path; @@ -933,7 +933,7 @@ namespace libtorrent // The ``storage_moved_failed_alert`` is generated when an attempt to move the storage, // via torrent_handle::move_storage(), fails. - struct TORRENT_EXPORT storage_moved_failed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT storage_moved_failed_alert final : torrent_alert { // internal storage_moved_failed_alert(aux::stack_allocator& alloc @@ -945,7 +945,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(storage_moved_failed_alert, 34) static const int static_category = alert::storage_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; error_code error; @@ -973,7 +973,7 @@ namespace libtorrent // // This alert is posted in the ``storage_notification`` category, and that bit // needs to be set in the alert_mask. - struct TORRENT_EXPORT torrent_deleted_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT torrent_deleted_alert final : torrent_alert { // internal torrent_deleted_alert(aux::stack_allocator& alloc @@ -982,7 +982,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT_PRIO(torrent_deleted_alert, 35) static const int static_category = alert::storage_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; sha1_hash info_hash; @@ -990,7 +990,7 @@ namespace libtorrent // This alert is generated when a request to delete the files of a torrent fails. // Just removing a torrent from the session cannot fail - struct TORRENT_EXPORT torrent_delete_failed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT torrent_delete_failed_alert final : torrent_alert { // internal torrent_delete_failed_alert(aux::stack_allocator& alloc @@ -1000,7 +1000,7 @@ namespace libtorrent static const int static_category = alert::storage_notification | alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // tells you why it failed. error_code error; @@ -1015,7 +1015,7 @@ namespace libtorrent // This alert is generated as a response to a ``torrent_handle::save_resume_data`` request. // It is generated once the disk IO thread is done writing the state for this torrent. - struct TORRENT_EXPORT save_resume_data_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT save_resume_data_alert final : torrent_alert { // internal save_resume_data_alert(aux::stack_allocator& alloc @@ -1025,7 +1025,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT_PRIO(save_resume_data_alert, 37) static const int static_category = alert::storage_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // points to the resume data. boost::shared_ptr resume_data; @@ -1033,7 +1033,7 @@ namespace libtorrent // This alert is generated instead of ``save_resume_data_alert`` if there was an error // generating the resume data. ``error`` describes what went wrong. - struct TORRENT_EXPORT save_resume_data_failed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT save_resume_data_failed_alert final : torrent_alert { // internal save_resume_data_failed_alert(aux::stack_allocator& alloc @@ -1043,7 +1043,7 @@ namespace libtorrent static const int static_category = alert::storage_notification | alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the error code from the resume_data failure error_code error; @@ -1056,7 +1056,7 @@ namespace libtorrent // This alert is generated as a response to a ``torrent_handle::pause`` request. It is // generated once all disk IO is complete and the files in the torrent have been closed. // This is useful for synchronizing with the disk. - struct TORRENT_EXPORT torrent_paused_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT torrent_paused_alert final : torrent_alert { // internal torrent_paused_alert(aux::stack_allocator& alloc, torrent_handle const& h); @@ -1064,12 +1064,12 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_paused_alert, 39) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; }; // This alert is generated as a response to a torrent_handle::resume() request. It is // generated when a torrent goes from a paused state to an active state. - struct TORRENT_EXPORT torrent_resumed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT torrent_resumed_alert final : torrent_alert { // internal torrent_resumed_alert(aux::stack_allocator& alloc, torrent_handle const& h); @@ -1077,12 +1077,12 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_resumed_alert, 40) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; }; // This alert is posted when a torrent completes checking. i.e. when it transitions // out of the ``checking files`` state into a state where it is ready to start downloading - struct TORRENT_EXPORT torrent_checked_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT torrent_checked_alert final : torrent_alert { // internal torrent_checked_alert(aux::stack_allocator& alloc, torrent_handle const& h); @@ -1090,11 +1090,11 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_checked_alert, 41) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; }; // This alert is generated when a HTTP seed name lookup fails. - struct TORRENT_EXPORT url_seed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT url_seed_alert final : torrent_alert { // internal url_seed_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -1105,7 +1105,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(url_seed_alert, 42) static const int static_category = alert::peer_notification | alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; #ifndef TORRENT_NO_DEPRECATE // the HTTP seed that failed @@ -1133,7 +1133,7 @@ namespace libtorrent // If the storage fails to read or write files that it needs access to, this alert is // generated and the torrent is paused. - struct TORRENT_EXPORT file_error_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT file_error_alert final : torrent_alert { // internal file_error_alert(aux::stack_allocator& alloc @@ -1147,7 +1147,7 @@ namespace libtorrent static const int static_category = alert::status_notification | alert::error_notification | alert::storage_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; #ifndef TORRENT_NO_DEPRECATE // the path to the file that was accessed when the error occurred. @@ -1172,7 +1172,7 @@ namespace libtorrent // failed to match it. i.e. the metadata that was received was corrupt. libtorrent will // automatically retry to fetch it in this case. This is only relevant when running a // torrent-less download, with the metadata extension provided by libtorrent. - struct TORRENT_EXPORT metadata_failed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT metadata_failed_alert final : torrent_alert { // internal metadata_failed_alert(aux::stack_allocator& alloc @@ -1181,7 +1181,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(metadata_failed_alert, 44) static const int static_category = alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // indicates what failed when parsing the metadata. This error is // what's returned from lazy_bdecode(). @@ -1212,7 +1212,7 @@ namespace libtorrent // } // } // - struct TORRENT_EXPORT metadata_received_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT metadata_received_alert final : torrent_alert { // internal metadata_received_alert(aux::stack_allocator& alloc @@ -1221,13 +1221,13 @@ namespace libtorrent TORRENT_DEFINE_ALERT(metadata_received_alert, 45) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; }; // This alert is posted when there is an error on the UDP socket. The // UDP socket is used for all uTP, DHT and UDP tracker traffic. It's // global to the session. - struct TORRENT_EXPORT udp_error_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT udp_error_alert final : alert { // internal udp_error_alert( @@ -1238,7 +1238,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(udp_error_alert, 46) static const int static_category = alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the source address associated with the error (if any) udp::endpoint endpoint; @@ -1251,7 +1251,7 @@ namespace libtorrent // generated. The external IP address can be acquired from the tracker (if it // supports that) or from peers that supports the extension protocol. // The address can be accessed through the ``external_address`` member. - struct TORRENT_EXPORT external_ip_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT external_ip_alert final : alert { // internal external_ip_alert(aux::stack_allocator& alloc, address const& ip); @@ -1259,7 +1259,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(external_ip_alert, 47) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the IP address that is believed to be our external IP address external_address; @@ -1274,7 +1274,7 @@ namespace libtorrent // Port 0 asks the operating system to pick a port that's free). If that fails // you may see a listen_failed_alert with port 0 even if you didn't ask to // listen on it. - struct TORRENT_EXPORT listen_failed_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT listen_failed_alert final : alert { enum socket_type_t { tcp, tcp_ssl, udp, i2p, socks5, utp_ssl }; @@ -1290,7 +1290,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT_PRIO(listen_failed_alert, 48) static const int static_category = alert::status_notification | alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the network device libtorrent attempted to listen on, or the IP address char const* listen_interface() const; @@ -1320,7 +1320,7 @@ namespace libtorrent // This alert is posted when the listen port succeeds to be opened on a // particular interface. ``endpoint`` is the endpoint that successfully // was opened for listening. - struct TORRENT_EXPORT listen_succeeded_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT listen_succeeded_alert final : alert { enum socket_type_t { tcp, tcp_ssl, udp, utp_ssl }; @@ -1331,7 +1331,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT_PRIO(listen_succeeded_alert, 49) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the endpoint libtorrent ended up listening on. The address // refers to the local interface and the port is the listen port. @@ -1347,7 +1347,7 @@ namespace libtorrent // case it appears the client is not running on a NAT:ed network or if it // appears there is no NAT router that can be remote controlled to add port // mappings. - struct TORRENT_EXPORT portmap_error_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT portmap_error_alert final : alert { // internal portmap_error_alert(aux::stack_allocator& alloc, int i, int t @@ -1357,7 +1357,7 @@ namespace libtorrent static const int static_category = alert::port_mapping_notification | alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // refers to the mapping index of the port map that failed, i.e. // the index returned from add_mapping(). @@ -1377,7 +1377,7 @@ namespace libtorrent // a port was successfully mapped on it. On a NAT:ed network with a NAT-PMP // capable router, this is typically generated once when mapping the TCP // port and, if DHT is enabled, when the UDP port is mapped. - struct TORRENT_EXPORT portmap_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT portmap_alert final : alert { // internal portmap_alert(aux::stack_allocator& alloc, int i, int port, int t, int protocol); @@ -1385,7 +1385,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(portmap_alert, 51) static const int static_category = alert::port_mapping_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // refers to the mapping index of the port map that failed, i.e. // the index returned from add_mapping(). @@ -1415,7 +1415,7 @@ namespace libtorrent // for debugging the UPnP or NAT-PMP implementation. This alert is only // posted if the alert::port_mapping_log_notification flag is enabled in // the alert mask. - struct TORRENT_EXPORT portmap_log_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT portmap_log_alert final : alert { // internal portmap_log_alert(aux::stack_allocator& alloc, int t, const char* m); @@ -1423,7 +1423,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(portmap_log_alert, 52) static const int static_category = alert::port_mapping_log_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; int map_type; @@ -1447,7 +1447,7 @@ namespace libtorrent // This alert is generated when a fastresume file has been passed to // add_torrent() but the files on disk did not match the fastresume file. // The error_code explains the reason why the resume file was rejected. - struct TORRENT_EXPORT fastresume_rejected_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT fastresume_rejected_alert final : torrent_alert { // internal fastresume_rejected_alert(aux::stack_allocator& alloc @@ -1460,7 +1460,7 @@ namespace libtorrent static const int static_category = alert::status_notification | alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; error_code error; @@ -1491,7 +1491,7 @@ namespace libtorrent // * the port filter // * the peer has a low port and ``no_connect_privileged_ports`` is enabled // * the protocol of the peer is blocked (uTP/TCP blocking) - struct TORRENT_EXPORT peer_blocked_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT peer_blocked_alert final : torrent_alert { // internal peer_blocked_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -1500,7 +1500,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_blocked_alert, 54) static const int static_category = alert::ip_block_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the address that was blocked. address ip; @@ -1521,7 +1521,7 @@ namespace libtorrent // This alert is generated when a DHT node announces to an info-hash on our // DHT node. It belongs to the ``dht_notification`` category. - struct TORRENT_EXPORT dht_announce_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT dht_announce_alert final : alert { // internal dht_announce_alert(aux::stack_allocator& alloc, address const& i, int p @@ -1530,7 +1530,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_announce_alert, 55) static const int static_category = alert::dht_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; address ip; int port; @@ -1539,7 +1539,7 @@ namespace libtorrent // This alert is generated when a DHT node sends a ``get_peers`` message to // our DHT node. It belongs to the ``dht_notification`` category. - struct TORRENT_EXPORT dht_get_peers_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT dht_get_peers_alert final : alert { // internal dht_get_peers_alert(aux::stack_allocator& alloc, sha1_hash const& ih); @@ -1547,7 +1547,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_get_peers_alert, 56) static const int static_category = alert::dht_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; sha1_hash info_hash; }; @@ -1555,7 +1555,7 @@ namespace libtorrent // This alert is posted approximately once every second, and it contains // byte counters of most statistics that's tracked for torrents. Each active // torrent posts these alerts regularly. - struct TORRENT_EXPORT stats_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT stats_alert final : torrent_alert { // internal stats_alert(aux::stack_allocator& alloc, torrent_handle const& h, int interval @@ -1564,7 +1564,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(stats_alert, 57) static const int static_category = alert::stats_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; enum stats_channel { @@ -1607,7 +1607,7 @@ namespace libtorrent // enabled to let this alert through. The alert is also posted when removing // a torrent from the session, once the outstanding cache flush is complete // and the torrent does no longer have any files open. - struct TORRENT_EXPORT cache_flushed_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT cache_flushed_alert final : torrent_alert { // internal cache_flushed_alert(aux::stack_allocator& alloc, torrent_handle const& h); @@ -1621,7 +1621,7 @@ namespace libtorrent // anonymous mode. For instance, if the tracker proxy is not set up, no // trackers will be used, because trackers can only be used through proxies // when in anonymous mode. - struct TORRENT_EXPORT anonymous_mode_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT anonymous_mode_alert final : torrent_alert { // internal anonymous_mode_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -1630,7 +1630,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(anonymous_mode_alert, 59) static const int static_category = alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; enum kind_t { @@ -1647,7 +1647,7 @@ namespace libtorrent // This alert is generated when we receive a local service discovery message // from a peer for a torrent we're currently participating in. - struct TORRENT_EXPORT lsd_peer_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT lsd_peer_alert final : peer_alert { // internal lsd_peer_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -1656,13 +1656,13 @@ namespace libtorrent TORRENT_DEFINE_ALERT(lsd_peer_alert, 60) static const int static_category = alert::peer_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; }; // This alert is posted whenever a tracker responds with a ``trackerid``. // The tracker ID is like a cookie. The libtorrent will store the tracker ID // for this tracker and repeat it in subsequent announces. - struct TORRENT_EXPORT trackerid_alert TORRENT_FINAL : tracker_alert + struct TORRENT_EXPORT trackerid_alert final : tracker_alert { // internal trackerid_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -1672,7 +1672,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(trackerid_alert, 61) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; #ifndef TORRENT_NO_DEPRECATE // The tracker ID returned by the tracker @@ -1687,7 +1687,7 @@ namespace libtorrent }; // This alert is posted when the initial DHT bootstrap is done. - struct TORRENT_EXPORT dht_bootstrap_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT dht_bootstrap_alert final : alert { // internal dht_bootstrap_alert(aux::stack_allocator& alloc); @@ -1695,11 +1695,11 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_bootstrap_alert, 62) static const int static_category = alert::dht_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; }; // This is posted whenever a torrent is transitioned into the error state. - struct TORRENT_EXPORT torrent_error_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT torrent_error_alert final : torrent_alert { // internal torrent_error_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -1708,7 +1708,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_error_alert, 64) static const int static_category = alert::error_notification | alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // specifies which error the torrent encountered. error_code error; @@ -1729,7 +1729,7 @@ namespace libtorrent // the torrent won't work unless torrent_handle::set_ssl_certificate() is called with // a valid certificate. Valid certificates MUST be signed by the SSL certificate // in the .torrent file. - struct TORRENT_EXPORT torrent_need_cert_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT torrent_need_cert_alert final : torrent_alert { // internal torrent_need_cert_alert(aux::stack_allocator& alloc @@ -1738,7 +1738,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT_PRIO(torrent_need_cert_alert, 65) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; error_code error; }; @@ -1749,7 +1749,7 @@ namespace libtorrent // the UDP listen socket for uTP sockets. However, connections may also be // accepted offer a Socks5 or i2p listen socket, or via a torrent specific // listen socket for SSL torrents. - struct TORRENT_EXPORT incoming_connection_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT incoming_connection_alert final : alert { // internal incoming_connection_alert(aux::stack_allocator& alloc, int t @@ -1758,7 +1758,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(incoming_connection_alert, 66) static const int static_category = alert::peer_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // tells you what kind of socket the connection was accepted // as: @@ -1784,7 +1784,7 @@ namespace libtorrent // and contains the return status of the add operation. The torrent handle of the new // torrent can be found in the base class' ``handle`` member. If adding // the torrent failed, ``error`` contains the error code. - struct TORRENT_EXPORT add_torrent_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT add_torrent_alert final : torrent_alert { // internal add_torrent_alert(aux::stack_allocator& alloc, torrent_handle h @@ -1793,7 +1793,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT_PRIO(add_torrent_alert, 67) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // a copy of the parameters used when adding the torrent, it can be used // to identify which invocation to ``async_add_torrent()`` caused this alert. @@ -1808,7 +1808,7 @@ namespace libtorrent // status of all torrents that changed since last time this message was // posted. Its category is ``status_notification``, but it's not subject to // filtering, since it's only manually posted anyway. - struct TORRENT_EXPORT state_update_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT state_update_alert final : alert { state_update_alert(aux::stack_allocator& alloc , std::vector st); @@ -1816,7 +1816,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT_PRIO(state_update_alert, 68) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // contains the torrent status of all torrents that changed since last // time this message was posted. Note that you can map a torrent status @@ -1826,14 +1826,14 @@ namespace libtorrent std::vector status; }; - struct TORRENT_EXPORT mmap_cache_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT mmap_cache_alert final : alert { mmap_cache_alert(aux::stack_allocator& alloc , error_code const& ec); TORRENT_DEFINE_ALERT(mmap_cache_alert, 69) static const int static_category = alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; error_code error; }; @@ -1842,13 +1842,13 @@ namespace libtorrent // calling post_session_stats() on the session object. Its category is // ``status_notification``, but it is not subject to filtering, since it's only // manually posted anyway. - struct TORRENT_EXPORT session_stats_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT session_stats_alert final : alert { session_stats_alert(aux::stack_allocator& alloc, counters const& cnt); TORRENT_DEFINE_ALERT_PRIO(session_stats_alert, 70) static const int static_category = alert::stats_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // An array are a mix of *counters* and *gauges*, which meanings can be // queries via the session_stats_metrics() function on the session. The @@ -1871,7 +1871,7 @@ namespace libtorrent // // Once this download completes, the ``torrent_update_alert`` is posted to // notify the client of the info-hash changing. - struct TORRENT_EXPORT torrent_update_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT torrent_update_alert final : torrent_alert { // internal torrent_update_alert(aux::stack_allocator& alloc, torrent_handle h @@ -1880,7 +1880,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT_PRIO(torrent_update_alert, 71) static const int static_category = alert::status_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // ``old_ih`` and ``new_ih`` are the previous and new info-hash for the torrent, respectively. sha1_hash old_ih; @@ -1890,7 +1890,7 @@ namespace libtorrent // posted when something fails in the DHT. This is not necessarily a fatal // error, but it could prevent proper operation - struct TORRENT_EXPORT dht_error_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT dht_error_alert final : alert { // internal dht_error_alert(aux::stack_allocator& alloc, int op, error_code const& ec); @@ -1898,7 +1898,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_error_alert, 73) static const int static_category = alert::error_notification | alert::dht_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the error code error_code error; @@ -1915,7 +1915,7 @@ namespace libtorrent // this alert is posted as a response to a call to session::get_item(), // specifically the overload for looking up immutable items in the DHT. - struct TORRENT_EXPORT dht_immutable_item_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT dht_immutable_item_alert final : alert { dht_immutable_item_alert(aux::stack_allocator& alloc, sha1_hash const& t , entry const& i); @@ -1924,7 +1924,7 @@ namespace libtorrent static const int static_category = alert::dht_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the target hash of the immutable item. This must // match the sha-1 hash of the bencoded form of ``item``. @@ -1936,7 +1936,7 @@ namespace libtorrent // this alert is posted as a response to a call to session::get_item(), // specifically the overload for looking up mutable items in the DHT. - struct TORRENT_EXPORT dht_mutable_item_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT dht_mutable_item_alert final : alert { dht_mutable_item_alert(aux::stack_allocator& alloc , boost::array k @@ -1949,7 +1949,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT_PRIO(dht_mutable_item_alert, 75) static const int static_category = alert::dht_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the public key that was looked up boost::array key; @@ -1977,7 +1977,7 @@ namespace libtorrent // this is posted when a DHT put operation completes. This is useful if the // client is waiting for a put to complete before shutting down for instance. - struct TORRENT_EXPORT dht_put_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT dht_put_alert final : alert { // internal dht_put_alert(aux::stack_allocator& alloc, sha1_hash const& t, int n); @@ -1990,7 +1990,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_put_alert, 76) static const int static_category = alert::dht_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the target hash the item was stored under if this was an *immutable* // item. @@ -2011,14 +2011,14 @@ namespace libtorrent }; // this alert is used to report errors in the i2p SAM connection - struct TORRENT_EXPORT i2p_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT i2p_alert final : alert { i2p_alert(aux::stack_allocator& alloc, error_code const& ec); TORRENT_DEFINE_ALERT(i2p_alert, 77) static const int static_category = alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the error that occurred in the i2p SAM connection error_code error; @@ -2026,7 +2026,7 @@ namespace libtorrent // This alert is generated when we send a get_peers request // It belongs to the ``dht_notification`` category. - struct TORRENT_EXPORT dht_outgoing_get_peers_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT dht_outgoing_get_peers_alert final : alert { // internal dht_outgoing_get_peers_alert(aux::stack_allocator& alloc @@ -2036,7 +2036,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_outgoing_get_peers_alert, 78) static const int static_category = alert::dht_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the info_hash of the torrent we're looking for peers for. sha1_hash info_hash; @@ -2054,7 +2054,7 @@ namespace libtorrent // trouble shooting and debugging. It's not enabled by the default alert // mask and is enabled by the ``alert::session_log_notification`` bit. // Furthermore, it's by default disabled as a build configuration. - struct TORRENT_EXPORT log_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT log_alert final : alert { // internal log_alert(aux::stack_allocator& alloc, char const* log); @@ -2062,7 +2062,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(log_alert, 79) static const int static_category = alert::session_log_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // returns the log message char const* msg() const; @@ -2076,7 +2076,7 @@ namespace libtorrent // trouble shooting and debugging. It's not enabled by the default alert // mask and is enabled by the ``alert::torrent_log_notification`` bit. By // default it is disabled as a build configuration. - struct TORRENT_EXPORT torrent_log_alert TORRENT_FINAL : torrent_alert + struct TORRENT_EXPORT torrent_log_alert final : torrent_alert { // internal torrent_log_alert(aux::stack_allocator& alloc, torrent_handle const& h @@ -2085,7 +2085,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(torrent_log_alert, 80) static const int static_category = alert::torrent_log_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // returns the log message char const* msg() const; @@ -2098,7 +2098,7 @@ namespace libtorrent // for trouble shooting and debugging. It's not enabled by the default alert // mask and is enabled by the ``alert::peer_log_notification`` bit. By // default it is disabled as a build configuration. - struct TORRENT_EXPORT peer_log_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT peer_log_alert final : peer_alert { // describes whether this log refers to in-flow or out-flow of the // peer. The exception is ``info`` which is neither incoming or outgoing. @@ -2120,7 +2120,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(peer_log_alert, 81) static const int static_category = alert::peer_log_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // string literal indicating the kind of event. For messages, this is the // message name. @@ -2139,7 +2139,7 @@ namespace libtorrent // posted if the local service discovery socket fails to start properly. // it's categorized as ``error_notification``. - struct TORRENT_EXPORT lsd_error_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT lsd_error_alert final : alert { // internal lsd_error_alert(aux::stack_allocator& alloc, error_code const& ec); @@ -2147,7 +2147,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(lsd_error_alert, 82) static const int static_category = alert::error_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // The error code error_code error; @@ -2211,7 +2211,7 @@ namespace libtorrent }; // contains current DHT state. Posted in response to session::post_dht_stats(). - struct TORRENT_EXPORT dht_stats_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT dht_stats_alert final : alert { // internal dht_stats_alert(aux::stack_allocator& alloc @@ -2221,7 +2221,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_stats_alert, 83) static const int static_category = alert::stats_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // a vector of the currently running DHT lookups. std::vector active_requests; @@ -2235,7 +2235,7 @@ namespace libtorrent // up for being serviced. This alert is only posted if // the alert::incoming_request_notification flag is enabled in the alert // mask. - struct TORRENT_EXPORT incoming_request_alert TORRENT_FINAL : peer_alert + struct TORRENT_EXPORT incoming_request_alert final : peer_alert { // internal incoming_request_alert(aux::stack_allocator& alloc @@ -2245,13 +2245,13 @@ namespace libtorrent static const int static_category = alert::incoming_request_notification; TORRENT_DEFINE_ALERT(incoming_request_alert, 84) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the request this peer sent to us peer_request req; }; - struct TORRENT_EXPORT dht_log_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT dht_log_alert final : alert { enum dht_module_t { @@ -2268,7 +2268,7 @@ namespace libtorrent static const int static_category = alert::dht_log_notification; TORRENT_DEFINE_ALERT(dht_log_alert, 85) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // the log message char const* log_message() const; @@ -2284,7 +2284,7 @@ namespace libtorrent // This alert is posted every time a DHT message is sent or received. It is // only posted if the ``alert::dht_log_notification`` alert category is // enabled. It contains a verbatim copy of the message. - struct TORRENT_EXPORT dht_pkt_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT dht_pkt_alert final : alert { enum direction_t { incoming, outgoing }; @@ -2295,7 +2295,7 @@ namespace libtorrent static const int static_category = alert::dht_log_notification; TORRENT_DEFINE_ALERT(dht_pkt_alert, 86) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; // returns a pointer to the packet buffer and size of the packet, // respectively. This buffer is only valid for as long as the alert itself @@ -2317,7 +2317,7 @@ namespace libtorrent int m_size; }; - struct TORRENT_EXPORT dht_get_peers_reply_alert TORRENT_FINAL : alert { + struct TORRENT_EXPORT dht_get_peers_reply_alert final : alert { dht_get_peers_reply_alert(aux::stack_allocator& alloc , sha1_hash const& ih @@ -2326,7 +2326,7 @@ namespace libtorrent static const int static_category = alert::dht_operation_notification; TORRENT_DEFINE_ALERT(dht_get_peers_reply_alert, 87) - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; sha1_hash info_hash; @@ -2346,7 +2346,7 @@ namespace libtorrent // This is posted exactly once for every call to session_handle::dht_direct_request. // If the request failed, response() will return a default constructed bdecode_node. - struct TORRENT_EXPORT dht_direct_response_alert TORRENT_FINAL : alert + struct TORRENT_EXPORT dht_direct_response_alert final : alert { dht_direct_response_alert(aux::stack_allocator& alloc, void* userdata , udp::endpoint const& addr, bdecode_node const& response); @@ -2358,7 +2358,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(dht_direct_response_alert, 88) static const int static_category = alert::dht_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; void* userdata; udp::endpoint addr; @@ -2386,7 +2386,7 @@ namespace libtorrent TORRENT_DEFINE_ALERT(picker_log_alert, 89) static const int static_category = alert::picker_log_notification; - virtual std::string message() const TORRENT_OVERRIDE; + virtual std::string message() const override; #endif // TORRENT_DISABLE_LOGGING diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index daba7b98b..4ea94c09d 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -186,7 +186,7 @@ namespace libtorrent // this is the link between the main thread and the // thread started to run the main downloader loop - struct TORRENT_EXTRA_EXPORT session_impl TORRENT_FINAL + struct TORRENT_EXTRA_EXPORT session_impl final : session_interface , dht::dht_observer , boost::noncopyable @@ -224,10 +224,10 @@ namespace libtorrent void add_ses_extension(boost::shared_ptr ext); #endif #if TORRENT_USE_ASSERTS - bool has_peer(peer_connection const* p) const TORRENT_OVERRIDE; - bool any_torrent_has_peer(peer_connection const* p) const TORRENT_OVERRIDE; - bool is_single_thread() const TORRENT_OVERRIDE { return single_threaded::is_single_thread(); } - bool is_posting_torrent_updates() const TORRENT_OVERRIDE { return m_posting_torrent_updates; } + bool has_peer(peer_connection const* p) const override; + bool any_torrent_has_peer(peer_connection const* p) const override; + bool is_single_thread() const override { return single_threaded::is_single_thread(); } + bool is_posting_torrent_updates() const override { return m_posting_torrent_updates; } // this is set while the session is building the // torrent status update message bool m_posting_torrent_updates; @@ -235,15 +235,15 @@ namespace libtorrent void reopen_listen_sockets(); - torrent_peer_allocator_interface* get_peer_allocator() TORRENT_OVERRIDE + torrent_peer_allocator_interface* get_peer_allocator() override { return &m_peer_allocator; } - io_service& get_io_service() TORRENT_OVERRIDE { return m_io_service; } - resolver_interface& get_resolver() TORRENT_OVERRIDE { return m_host_resolver; } + io_service& get_io_service() override { return m_io_service; } + resolver_interface& get_resolver() override { return m_host_resolver; } void async_resolve(std::string const& host, int flags - , callback_t const& h) TORRENT_OVERRIDE; + , callback_t const& h) override; - std::vector& torrent_list(int i) TORRENT_OVERRIDE + std::vector& torrent_list(int i) override { TORRENT_ASSERT(i >= 0); TORRENT_ASSERT(i < session_interface::num_torrent_lists); @@ -254,10 +254,10 @@ namespace libtorrent // attempts, because this torrent needs more peers. // this is typically done when a torrent starts out and // need the initial push to connect peers - void prioritize_connections(boost::weak_ptr t) TORRENT_OVERRIDE; + void prioritize_connections(boost::weak_ptr t) override; - tcp::endpoint get_ipv6_interface() const TORRENT_OVERRIDE; - tcp::endpoint get_ipv4_interface() const TORRENT_OVERRIDE; + tcp::endpoint get_ipv6_interface() const override; + tcp::endpoint get_ipv4_interface() const override; void async_accept(boost::shared_ptr const& listener, bool ssl); void on_accept_connection(boost::shared_ptr const& s @@ -267,49 +267,49 @@ namespace libtorrent void incoming_connection(boost::shared_ptr const& s); - boost::weak_ptr find_torrent(sha1_hash const& info_hash) const TORRENT_OVERRIDE; + boost::weak_ptr find_torrent(sha1_hash const& info_hash) const override; #ifndef TORRENT_NO_DEPRECATE //deprecated in 1.2 boost::weak_ptr find_torrent(std::string const& uuid) const; #endif #ifndef TORRENT_DISABLE_MUTABLE_TORRENTS std::vector > find_collection( - std::string const& collection) const TORRENT_OVERRIDE; + std::string const& collection) const override; #endif - boost::weak_ptr find_disconnect_candidate_torrent() const TORRENT_OVERRIDE; - int num_torrents() const TORRENT_OVERRIDE { return int(m_torrents.size()); } + boost::weak_ptr find_disconnect_candidate_torrent() const override; + int num_torrents() const override { return int(m_torrents.size()); } void insert_torrent(sha1_hash const& ih, boost::shared_ptr const& t - , std::string uuid) TORRENT_OVERRIDE; + , std::string uuid) override; #ifndef TORRENT_NO_DEPRECATE //deprecated in 1.2 - void insert_uuid_torrent(std::string uuid, boost::shared_ptr const& t) TORRENT_OVERRIDE + void insert_uuid_torrent(std::string uuid, boost::shared_ptr const& t) override { m_uuids.insert(std::make_pair(uuid, t)); } #endif boost::shared_ptr delay_load_torrent(sha1_hash const& info_hash - , peer_connection* pc) TORRENT_OVERRIDE; - void set_queue_position(torrent* t, int p) TORRENT_OVERRIDE; + , peer_connection* pc) override; + void set_queue_position(torrent* t, int p) override; - peer_id const& get_peer_id() const TORRENT_OVERRIDE { return m_peer_id; } + peer_id const& get_peer_id() const override { return m_peer_id; } - void close_connection(peer_connection* p, error_code const& ec) TORRENT_OVERRIDE; + void close_connection(peer_connection* p, error_code const& ec) override; #ifndef TORRENT_NO_DEPRECATE void set_settings(libtorrent::session_settings const& s); libtorrent::session_settings deprecated_settings() const; #endif - void apply_settings_pack(boost::shared_ptr pack) TORRENT_OVERRIDE; + void apply_settings_pack(boost::shared_ptr pack) override; void apply_settings_pack_impl(settings_pack const& pack); - session_settings const& settings() const TORRENT_OVERRIDE { return m_settings; } + session_settings const& settings() const override { return m_settings; } settings_pack get_settings() const; #ifndef TORRENT_DISABLE_DHT - dht::dht_tracker* dht() TORRENT_OVERRIDE { return m_dht.get(); } - bool announce_dht() const TORRENT_OVERRIDE { return !m_listen_sockets.empty(); } + dht::dht_tracker* dht() override { return m_dht.get(); } + bool announce_dht() const override { return !m_listen_sockets.empty(); } void add_dht_node_name(std::pair const& node); - void add_dht_node(udp::endpoint n) TORRENT_OVERRIDE; + void add_dht_node(udp::endpoint n) override; void add_dht_router(std::pair const& node); void set_dht_settings(dht_settings const& s); dht_settings const& get_dht_settings() const { return m_dht_settings; } @@ -317,12 +317,12 @@ namespace libtorrent void start_dht(); void stop_dht(); void start_dht(entry const& startup_state); - bool has_dht() const TORRENT_OVERRIDE; + bool has_dht() const override; // this is called for torrents when they are started // it will prioritize them for announcing to // the DHT, to get the initial peers quickly - void prioritize_dht(boost::weak_ptr t) TORRENT_OVERRIDE; + void prioritize_dht(boost::weak_ptr t) override; void get_immutable_callback(sha1_hash target , dht::item const& i); @@ -358,9 +358,9 @@ namespace libtorrent #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) torrent const* find_encrypted_torrent( - sha1_hash const& info_hash, sha1_hash const& xor_mask) TORRENT_OVERRIDE; + sha1_hash const& info_hash, sha1_hash const& xor_mask) override; - void add_obfuscated_hash(sha1_hash const& obfuscated, boost::weak_ptr const& t) TORRENT_OVERRIDE; + void add_obfuscated_hash(sha1_hash const& obfuscated, boost::weak_ptr const& t) override; #endif void on_port_map_log(char const* msg, int map_transport); @@ -375,8 +375,8 @@ namespace libtorrent void on_port_mapping(int mapping, address const& ip, int port , int protocol, error_code const& ec, int nat_transport); - bool is_aborted() const TORRENT_OVERRIDE { return m_abort; } - bool is_paused() const TORRENT_OVERRIDE { return m_paused; } + bool is_aborted() const override { return m_abort; } + bool is_paused() const override { return m_paused; } void pause(); void resume(); @@ -385,22 +385,22 @@ namespace libtorrent ip_filter const& get_ip_filter(); void set_port_filter(port_filter const& f); - port_filter const& get_port_filter() const TORRENT_OVERRIDE; - void ban_ip(address addr) TORRENT_OVERRIDE; + port_filter const& get_port_filter() const override; + void ban_ip(address addr) override; void queue_tracker_request(tracker_request& req - , boost::weak_ptr c) TORRENT_OVERRIDE; + , boost::weak_ptr c) override; // ==== peer class operations ==== // implements session_interface - void set_peer_classes(peer_class_set* s, address const& a, int st) TORRENT_OVERRIDE; - peer_class_pool const& peer_classes() const TORRENT_OVERRIDE { return m_classes; } - peer_class_pool& peer_classes() TORRENT_OVERRIDE { return m_classes; } - bool ignore_unchoke_slots_set(peer_class_set const& set) const TORRENT_OVERRIDE; + void set_peer_classes(peer_class_set* s, address const& a, int st) override; + peer_class_pool const& peer_classes() const override { return m_classes; } + peer_class_pool& peer_classes() override { return m_classes; } + bool ignore_unchoke_slots_set(peer_class_set const& set) const override; int copy_pertinent_channels(peer_class_set const& set - , int channel, bandwidth_channel** dst, int max) TORRENT_OVERRIDE; - int use_quota_overhead(peer_class_set& set, int amount_down, int amount_up) TORRENT_OVERRIDE; + , int channel, bandwidth_channel** dst, int max) override; + int use_quota_overhead(peer_class_set& set, int amount_down, int amount_up) override; bool use_quota_overhead(bandwidth_channel* ch, int amount); int create_peer_class(char const* name); @@ -426,8 +426,8 @@ namespace libtorrent void async_add_torrent(add_torrent_params* params); void on_async_load_torrent(disk_io_job const* j); - void remove_torrent(torrent_handle const& h, int options) TORRENT_OVERRIDE; - void remove_torrent_impl(boost::shared_ptr tptr, int options) TORRENT_OVERRIDE; + void remove_torrent(torrent_handle const& h, int options) override; + void remove_torrent_impl(boost::shared_ptr tptr, int options) override; void get_torrent_status(std::vector* ret , boost::function const& pred @@ -464,7 +464,7 @@ namespace libtorrent int max_uploads() const; #endif - bandwidth_manager* get_bandwidth_manager(int channel) TORRENT_OVERRIDE; + bandwidth_manager* get_bandwidth_manager(int channel) override; int upload_rate_limit(peer_class_t c) const; int download_rate_limit(peer_class_t c) const; @@ -474,19 +474,19 @@ namespace libtorrent void set_rate_limit(peer_class_t c, int channel, int limit); int rate_limit(peer_class_t c, int channel) const; - bool preemptive_unchoke() const TORRENT_OVERRIDE; - int num_uploads() const TORRENT_OVERRIDE + bool preemptive_unchoke() const override; + int num_uploads() const override { return int(m_stats_counters[counters::num_peers_up_unchoked]); } - int num_connections() const TORRENT_OVERRIDE { return int(m_connections.size()); } + int num_connections() const override { return int(m_connections.size()); } int peak_up_rate() const { return m_peak_up_rate; } - void trigger_unchoke() TORRENT_OVERRIDE + void trigger_unchoke() override { TORRENT_ASSERT(is_single_thread()); m_unchoke_time_scaler = 0; } - void trigger_optimistic_unchoke() TORRENT_OVERRIDE + void trigger_optimistic_unchoke() override { TORRENT_ASSERT(is_single_thread()); m_optimistic_unchoke_time_scaler = 0; @@ -499,30 +499,30 @@ namespace libtorrent void set_peer_id(peer_id const& id); void set_key(int key); address listen_address() const; - boost::uint16_t listen_port() const TORRENT_OVERRIDE; - boost::uint16_t ssl_listen_port() const TORRENT_OVERRIDE; + boost::uint16_t listen_port() const override; + boost::uint16_t ssl_listen_port() const override; - alert_manager& alerts() TORRENT_OVERRIDE { return m_alerts; } - disk_interface& disk_thread() TORRENT_OVERRIDE { return m_disk_thread; } + alert_manager& alerts() override { return m_alerts; } + disk_interface& disk_thread() override { return m_disk_thread; } void abort(); void abort_stage2(); torrent_handle find_torrent_handle(sha1_hash const& info_hash); - void announce_lsd(sha1_hash const& ih, int port, bool broadcast = false) TORRENT_OVERRIDE; + void announce_lsd(sha1_hash const& ih, int port, bool broadcast = false) override; void save_state(entry* e, boost::uint32_t flags) const; void load_state(bdecode_node const* e, boost::uint32_t flags); - bool has_connection(peer_connection* p) const TORRENT_OVERRIDE; - void insert_peer(boost::shared_ptr const& c) TORRENT_OVERRIDE; + bool has_connection(peer_connection* p) const override; + void insert_peer(boost::shared_ptr const& c) override; - proxy_settings proxy() const TORRENT_OVERRIDE; + proxy_settings proxy() const override; #ifndef TORRENT_DISABLE_DHT bool is_dht_running() const { return (m_dht.get() != NULL); } - int external_udp_port() const TORRENT_OVERRIDE + int external_udp_port() const override { for (std::list::const_iterator i = m_listen_sockets.begin() , end(m_listen_sockets.end()); i != end; ++i) @@ -534,8 +534,8 @@ namespace libtorrent #endif #if TORRENT_USE_I2P - char const* i2p_session() const TORRENT_OVERRIDE { return m_i2p_conn.session_id(); } - proxy_settings i2p_proxy() const TORRENT_OVERRIDE; + char const* i2p_session() const override { return m_i2p_conn.session_id(); } + proxy_settings i2p_proxy() const override; void on_i2p_open(error_code const& ec); void open_new_incoming_i2p_connection(); @@ -562,57 +562,57 @@ namespace libtorrent // t is the least recently used, then the next least recently // used is picked // returns true if the torrent was loaded successfully - bool load_torrent(torrent* t) TORRENT_OVERRIDE; + bool load_torrent(torrent* t) override; // bump t to the top of the list of least recently used. i.e. // make it the most recently used. This is done every time // an action is performed that required the torrent to be // loaded, indicating activity - void bump_torrent(torrent* t, bool back = true) TORRENT_OVERRIDE; + void bump_torrent(torrent* t, bool back = true) override; // evict torrents until there's space for one new torrent, void evict_torrents_except(torrent* ignore); - void evict_torrent(torrent* t) TORRENT_OVERRIDE; + void evict_torrent(torrent* t) override; - void deferred_submit_jobs() TORRENT_OVERRIDE; + void deferred_submit_jobs() override; - char* allocate_buffer() TORRENT_OVERRIDE; + char* allocate_buffer() override; torrent_peer* allocate_peer_entry(int type); void free_peer_entry(torrent_peer* p); - void free_buffer(char* buf) TORRENT_OVERRIDE; - int send_buffer_size() const TORRENT_OVERRIDE { return send_buffer_size_impl; } + void free_buffer(char* buf) override; + int send_buffer_size() const override { return send_buffer_size_impl; } // implements buffer_allocator_interface - void free_disk_buffer(char* buf) TORRENT_OVERRIDE; - char* allocate_disk_buffer(char const* category) TORRENT_OVERRIDE; + void free_disk_buffer(char* buf) override; + char* allocate_disk_buffer(char const* category) override; char* allocate_disk_buffer(bool& exceeded , boost::shared_ptr o - , char const* category) TORRENT_OVERRIDE; - void reclaim_block(block_cache_reference ref) TORRENT_OVERRIDE; + , char const* category) override; + void reclaim_block(block_cache_reference ref) override; bool exceeded_cache_use() const { return m_disk_thread.exceeded_cache_use(); } // implements dht_observer virtual void set_external_address(address const& ip - , address const& source) TORRENT_OVERRIDE; - virtual address external_address(udp proto) TORRENT_OVERRIDE; - virtual void get_peers(sha1_hash const& ih) TORRENT_OVERRIDE; - virtual void announce(sha1_hash const& ih, address const& addr, int port) TORRENT_OVERRIDE; + , address const& source) override; + virtual address external_address(udp proto) override; + virtual void get_peers(sha1_hash const& ih) override; + virtual void announce(sha1_hash const& ih, address const& addr, int port) override; virtual void outgoing_get_peers(sha1_hash const& target - , sha1_hash const& sent_target, udp::endpoint const& ep) TORRENT_OVERRIDE; + , sha1_hash const& sent_target, udp::endpoint const& ep) override; virtual void log(libtorrent::dht::dht_logger::module_t m, char const* fmt, ...) - TORRENT_OVERRIDE TORRENT_FORMAT(3,4); + override TORRENT_FORMAT(3,4); virtual void log_packet(message_direction_t dir, char const* pkt, int len - , udp::endpoint node) TORRENT_OVERRIDE; + , udp::endpoint node) override; virtual bool on_dht_request(char const* query, int query_len - , dht::msg const& request, entry& response) TORRENT_OVERRIDE; + , dht::msg const& request, entry& response) override; void set_external_address(address const& ip - , int source_type, address const& source) TORRENT_OVERRIDE; - virtual external_ip const& external_address() const TORRENT_OVERRIDE; + , int source_type, address const& source) override; + virtual external_ip const& external_address() const override; // used when posting synchronous function // calls to session_impl and torrent objects @@ -621,32 +621,32 @@ namespace libtorrent // cork a peer and schedule a delayed uncork // does nothing if the peer is already corked - void cork_burst(peer_connection* p) TORRENT_OVERRIDE; + void cork_burst(peer_connection* p) override; // uncork all peers added to the delayed uncork queue // implements uncork_interface - virtual void do_delayed_uncork() TORRENT_OVERRIDE; + virtual void do_delayed_uncork() override; - void post_socket_job(socket_job& j) TORRENT_OVERRIDE; + void post_socket_job(socket_job& j) override; // implements session_interface virtual tcp::endpoint bind_outgoing_socket(socket_type& s, address - const& remote_address, error_code& ec) const TORRENT_OVERRIDE; + const& remote_address, error_code& ec) const override; virtual bool verify_bound_address(address const& addr, bool utp - , error_code& ec) TORRENT_OVERRIDE; + , error_code& ec) override; - bool has_lsd() const TORRENT_OVERRIDE { return m_lsd.get() != NULL; } + bool has_lsd() const override { return m_lsd.get() != NULL; } - std::vector& block_info_storage() TORRENT_OVERRIDE { return m_block_info_storage; } + std::vector& block_info_storage() override { return m_block_info_storage; } - libtorrent::utp_socket_manager* utp_socket_manager() TORRENT_OVERRIDE + libtorrent::utp_socket_manager* utp_socket_manager() override { return &m_utp_socket_manager; } #ifdef TORRENT_USE_OPENSSL - libtorrent::utp_socket_manager* ssl_utp_socket_manager() TORRENT_OVERRIDE + libtorrent::utp_socket_manager* ssl_utp_socket_manager() override { return &m_ssl_utp_socket_manager; } #endif - void inc_boost_connections() TORRENT_OVERRIDE { ++m_boost_connections; } + void inc_boost_connections() override { ++m_boost_connections; } #ifndef TORRENT_NO_DEPRECATE void update_ssl_listen(); @@ -691,7 +691,7 @@ namespace libtorrent void update_connections_limit(); void update_alert_mask(); - void trigger_auto_manage() TORRENT_OVERRIDE; + void trigger_auto_manage() override; private: @@ -710,7 +710,7 @@ namespace libtorrent void on_trigger_auto_manage(); void on_lsd_peer(tcp::endpoint peer, sha1_hash const& ih); - void setup_socket_buffers(socket_type& s) TORRENT_OVERRIDE; + void setup_socket_buffers(socket_type& s) override; // the settings for the client aux::session_settings m_settings; @@ -954,11 +954,11 @@ namespace libtorrent stat m_stat; // implements session_interface - virtual void sent_bytes(int bytes_payload, int bytes_protocol) TORRENT_OVERRIDE; - virtual void received_bytes(int bytes_payload, int bytes_protocol) TORRENT_OVERRIDE; - virtual void trancieve_ip_packet(int bytes, bool ipv6) TORRENT_OVERRIDE; - virtual void sent_syn(bool ipv6) TORRENT_OVERRIDE; - virtual void received_synack(bool ipv6) TORRENT_OVERRIDE; + virtual void sent_bytes(int bytes_payload, int bytes_protocol) override; + virtual void received_bytes(int bytes_payload, int bytes_protocol) override; + virtual void trancieve_ip_packet(int bytes, bool ipv6) override; + virtual void sent_syn(bool ipv6) override; + virtual void received_synack(bool ipv6) override; int m_peak_up_rate; int m_peak_down_rate; @@ -976,7 +976,7 @@ namespace libtorrent void recalculate_optimistic_unchoke_slots(); time_point m_created; - boost::uint16_t session_time() const TORRENT_OVERRIDE + boost::uint16_t session_time() const override { // +1 is here to make it possible to distinguish uninitialized (to // 0) timestamps and timestamps of things that happened during the @@ -1054,7 +1054,6 @@ namespace libtorrent #ifdef TORRENT_USE_OPENSSL // used for uTP connections over SSL - udp_socket m_ssl_udp_socket; libtorrent::utp_socket_manager m_ssl_utp_socket_manager; #endif @@ -1146,10 +1145,10 @@ namespace libtorrent void check_invariant() const; #endif - counters& stats_counters() TORRENT_OVERRIDE { return m_stats_counters; } + counters& stats_counters() override { return m_stats_counters; } - void received_buffer(int size) TORRENT_OVERRIDE; - void sent_buffer(int size) TORRENT_OVERRIDE; + void received_buffer(int size) override; + void sent_buffer(int size) override; // each second tick the timer takes a little // bit longer than one second to trigger. The @@ -1162,8 +1161,8 @@ namespace libtorrent boost::uint16_t m_tick_residual; #ifndef TORRENT_DISABLE_LOGGING - virtual void session_log(char const* fmt, ...) const TORRENT_OVERRIDE TORRENT_FORMAT(2,3); - virtual void session_vlog(char const* fmt, va_list& va) const TORRENT_OVERRIDE TORRENT_FORMAT(2,0); + virtual void session_log(char const* fmt, ...) const override TORRENT_FORMAT(2,3); + virtual void session_vlog(char const* fmt, va_list& va) const override TORRENT_FORMAT(2,0); // this list of tracker loggers serves as tracker_callbacks when // shutting down. This list is just here to keep them alive during diff --git a/include/libtorrent/bencode.hpp b/include/libtorrent/bencode.hpp index 44a3e48f1..2d21374aa 100644 --- a/include/libtorrent/bencode.hpp +++ b/include/libtorrent/bencode.hpp @@ -98,7 +98,7 @@ namespace libtorrent { // hidden virtual const char* what() const TORRENT_EXCEPTION_THROW_SPECIFIER - TORRENT_OVERRIDE TORRENT_FINAL + override final { return "invalid bencoding"; } }; #endif diff --git a/include/libtorrent/bt_peer_connection.hpp b/include/libtorrent/bt_peer_connection.hpp index 97b9d1077..480c7adf0 100644 --- a/include/libtorrent/bt_peer_connection.hpp +++ b/include/libtorrent/bt_peer_connection.hpp @@ -79,7 +79,7 @@ namespace libtorrent bt_peer_connection(peer_connection_args const& pack , peer_id const& pid); - virtual void start() TORRENT_OVERRIDE; + virtual void start() override; enum { @@ -105,7 +105,7 @@ namespace libtorrent void switch_recv_crypto(boost::shared_ptr crypto); #endif - virtual int type() const TORRENT_OVERRIDE + virtual int type() const override { return peer_connection::bittorrent_connection; } enum message_type @@ -153,17 +153,17 @@ namespace libtorrent // work to do. void on_sent(error_code const& error - , std::size_t bytes_transferred) TORRENT_OVERRIDE; + , std::size_t bytes_transferred) override; void on_receive(error_code const& error - , std::size_t bytes_transferred) TORRENT_OVERRIDE; + , std::size_t bytes_transferred) override; void on_receive_impl(std::size_t bytes_transferred); #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) - virtual int hit_send_barrier(std::vector& iovec) TORRENT_OVERRIDE; + virtual int hit_send_barrier(std::vector& iovec) override; #endif - virtual void get_specific_peer_info(peer_info& p) const TORRENT_OVERRIDE; - virtual bool in_handshake() const TORRENT_OVERRIDE; + virtual void get_specific_peer_info(peer_info& p) const override; + virtual bool in_handshake() const override; bool packet_finished() const { return m_recv_buffer.packet_finished(); } #ifndef TORRENT_DISABLE_EXTENSIONS @@ -212,17 +212,17 @@ namespace libtorrent // the following functions appends messages // to the send buffer - void write_choke() TORRENT_OVERRIDE; - void write_unchoke() TORRENT_OVERRIDE; - void write_interested() TORRENT_OVERRIDE; - void write_not_interested() TORRENT_OVERRIDE; - void write_request(peer_request const& r) TORRENT_OVERRIDE; - void write_cancel(peer_request const& r) TORRENT_OVERRIDE; - void write_bitfield() TORRENT_OVERRIDE; - void write_have(int index) TORRENT_OVERRIDE; - void write_dont_have(int index) TORRENT_OVERRIDE; - void write_piece(peer_request const& r, disk_buffer_holder& buffer) TORRENT_OVERRIDE; - void write_keepalive() TORRENT_OVERRIDE; + void write_choke() override; + void write_unchoke() override; + void write_interested() override; + void write_not_interested() override; + void write_request(peer_request const& r) override; + void write_cancel(peer_request const& r) override; + void write_bitfield() override; + void write_have(int index) override; + void write_dont_have(int index) override; + void write_piece(peer_request const& r, disk_buffer_holder& buffer) override; + void write_keepalive() override; void write_handshake(bool plain_handshake = false); #ifndef TORRENT_DISABLE_EXTENSIONS void write_extensions(); @@ -239,12 +239,12 @@ namespace libtorrent // FAST extension void write_have_all(); void write_have_none(); - void write_reject_request(peer_request const&) TORRENT_OVERRIDE; - void write_allow_fast(int piece) TORRENT_OVERRIDE; - void write_suggest(int piece) TORRENT_OVERRIDE; + void write_reject_request(peer_request const&) override; + void write_allow_fast(int piece) override; + void write_suggest(int piece) override; - void on_connected() TORRENT_OVERRIDE; - void on_metadata() TORRENT_OVERRIDE; + void on_connected() override; + void on_metadata() override; #if TORRENT_USE_INVARIANT_CHECKS void check_invariant() const; @@ -259,7 +259,7 @@ namespace libtorrent // block. If the peer isn't downloading // a piece for the moment, the boost::optional // will be invalid. - boost::optional downloading_piece_progress() const TORRENT_OVERRIDE; + boost::optional downloading_piece_progress() const override; #if !defined(TORRENT_DISABLE_ENCRYPTION) && !defined(TORRENT_DISABLE_EXTENSIONS) @@ -301,7 +301,7 @@ public: virtual void append_const_send_buffer(char const* buffer, int size , chained_buffer::free_buffer_fun destructor = &nop , void* userdata = NULL, block_cache_reference ref - = block_cache_reference()) TORRENT_OVERRIDE; + = block_cache_reference()) override; private: diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp index eb683cf27..2320152ac 100644 --- a/include/libtorrent/config.hpp +++ b/include/libtorrent/config.hpp @@ -438,18 +438,6 @@ int snprintf(char* buf, int len, char const* fmt, ...) #endif #endif // __GLIBC__ -#if __cplusplus <= 199711L || defined BOOST_NO_CXX11_FINAL -#define TORRENT_FINAL -#else -#define TORRENT_FINAL final -#endif - -#if __cplusplus <= 199711L || defined BOOST_NO_CXX11_FINAL -#define TORRENT_OVERRIDE -#else -#define TORRENT_OVERRIDE override -#endif - #ifndef TORRENT_ICONV_ARG #define TORRENT_ICONV_ARG (char**) #endif diff --git a/include/libtorrent/disk_io_thread.hpp b/include/libtorrent/disk_io_thread.hpp index 8045e3c53..4801c3d09 100644 --- a/include/libtorrent/disk_io_thread.hpp +++ b/include/libtorrent/disk_io_thread.hpp @@ -281,7 +281,7 @@ namespace libtorrent // this is a singleton consisting of the thread and a queue // of disk io jobs - struct TORRENT_EXTRA_EXPORT disk_io_thread TORRENT_FINAL + struct TORRENT_EXTRA_EXPORT disk_io_thread final : disk_job_pool , disk_interface , buffer_allocator_interface @@ -299,60 +299,60 @@ namespace libtorrent void async_read(piece_manager* storage, peer_request const& r , boost::function const& handler, void* requester - , int flags = 0) TORRENT_OVERRIDE; + , int flags = 0) override; void async_write(piece_manager* storage, peer_request const& r , disk_buffer_holder& buffer , boost::function const& handler - , int flags = 0) TORRENT_OVERRIDE; + , int flags = 0) override; void async_hash(piece_manager* storage, int piece, int flags - , boost::function const& handler, void* requester) TORRENT_OVERRIDE; + , boost::function const& handler, void* requester) override; void async_move_storage(piece_manager* storage, std::string const& p, int flags - , boost::function const& handler) TORRENT_OVERRIDE; + , boost::function const& handler) override; void async_release_files(piece_manager* storage , boost::function const& handler - = boost::function()) TORRENT_OVERRIDE; + = boost::function()) override; void async_delete_files(piece_manager* storage, int options - , boost::function const& handler) TORRENT_OVERRIDE; + , boost::function const& handler) override; void async_check_files(piece_manager* storage , add_torrent_params const* resume_data , std::vector& links - , boost::function const& handler) TORRENT_OVERRIDE; + , boost::function const& handler) override; void async_rename_file(piece_manager* storage, int index, std::string const& name - , boost::function const& handler) TORRENT_OVERRIDE; + , boost::function const& handler) override; void async_stop_torrent(piece_manager* storage - , boost::function const& handler) TORRENT_OVERRIDE; + , boost::function const& handler) override; #ifndef TORRENT_NO_DEPRECATE void async_cache_piece(piece_manager* storage, int piece - , boost::function const& handler) TORRENT_OVERRIDE; + , boost::function const& handler) override; void async_finalize_file(piece_manager* storage, int file , boost::function const& handler - = boost::function()) TORRENT_OVERRIDE; + = boost::function()) override; #endif void async_flush_piece(piece_manager* storage, int piece , boost::function const& handler - = boost::function()) TORRENT_OVERRIDE; + = boost::function()) override; void async_set_file_priority(piece_manager* storage , std::vector const& prio - , boost::function const& handler) TORRENT_OVERRIDE; + , boost::function const& handler) override; void async_load_torrent(add_torrent_params* params - , boost::function const& handler) TORRENT_OVERRIDE; + , boost::function const& handler) override; void async_tick_torrent(piece_manager* storage - , boost::function const& handler) TORRENT_OVERRIDE; + , boost::function const& handler) override; - void clear_read_cache(piece_manager* storage) TORRENT_OVERRIDE; + void clear_read_cache(piece_manager* storage) override; void async_clear_piece(piece_manager* storage, int index - , boost::function const& handler) TORRENT_OVERRIDE; + , boost::function const& handler) override; // this is not asynchronous and requires that the piece does not // have any pending buffers. It's meant to be used for pieces that // were just read and hashed and failed the hash check. // there should be no read-operations left, and all buffers should // be discardable - void clear_piece(piece_manager* storage, int index) TORRENT_OVERRIDE; + void clear_piece(piece_manager* storage, int index) override; // implements buffer_allocator_interface - void reclaim_block(block_cache_reference ref) TORRENT_OVERRIDE; - void free_disk_buffer(char* buf) TORRENT_OVERRIDE { m_disk_cache.free_buffer(buf); } - char* allocate_disk_buffer(char const* category) TORRENT_OVERRIDE + void reclaim_block(block_cache_reference ref) override; + void free_disk_buffer(char* buf) override { m_disk_cache.free_buffer(buf); } + char* allocate_disk_buffer(char const* category) override { bool exceed = false; return allocate_disk_buffer(exceed, boost::shared_ptr(), category); @@ -360,14 +360,14 @@ namespace libtorrent void trigger_cache_trim(); char* allocate_disk_buffer(bool& exceeded, boost::shared_ptr o - , char const* category) TORRENT_OVERRIDE; + , char const* category) override; bool exceeded_cache_use() const { return m_disk_cache.exceeded_max_size(); } - void update_stats_counters(counters& c) const TORRENT_OVERRIDE; + void update_stats_counters(counters& c) const override; void get_cache_info(cache_status* ret, bool no_pieces = true - , piece_manager const* storage = 0) const TORRENT_OVERRIDE; + , piece_manager const* storage = 0) const override; // this submits all queued up jobs to the thread void submit_jobs(); @@ -375,7 +375,7 @@ namespace libtorrent block_cache* cache() { return &m_disk_cache; } #if TORRENT_USE_ASSERTS - bool is_disk_buffer(char* buffer) const TORRENT_OVERRIDE + bool is_disk_buffer(char* buffer) const override { return m_disk_cache.is_disk_buffer(buffer); } #endif @@ -387,7 +387,7 @@ namespace libtorrent void thread_fun(int thread_id, thread_type_t type , boost::shared_ptr w); - virtual file_pool& files() TORRENT_OVERRIDE { return m_file_pool; } + virtual file_pool& files() override { return m_file_pool; } io_service& get_io_service() { return m_ios; } diff --git a/include/libtorrent/http_seed_connection.hpp b/include/libtorrent/http_seed_connection.hpp index 92cca8e8c..739cb7d30 100644 --- a/include/libtorrent/http_seed_connection.hpp +++ b/include/libtorrent/http_seed_connection.hpp @@ -80,20 +80,20 @@ namespace libtorrent http_seed_connection(peer_connection_args const& pack , web_seed_t& web); - virtual int type() const TORRENT_OVERRIDE + virtual int type() const override { return peer_connection::http_seed_connection; } // called from the main loop when this connection has any // work to do. virtual void on_receive(error_code const& error - , std::size_t bytes_transferred) TORRENT_OVERRIDE; + , std::size_t bytes_transferred) override; - std::string const& url() const TORRENT_OVERRIDE { return m_url; } + std::string const& url() const override { return m_url; } - virtual void get_specific_peer_info(peer_info& p) const TORRENT_OVERRIDE; - virtual void disconnect(error_code const& ec, operation_t op, int error = 0) TORRENT_OVERRIDE; + virtual void get_specific_peer_info(peer_info& p) const override; + virtual void disconnect(error_code const& ec, operation_t op, int error = 0) override; - virtual void write_request(peer_request const& r) TORRENT_OVERRIDE; + virtual void write_request(peer_request const& r) override; private: @@ -102,7 +102,7 @@ namespace libtorrent // block. If the peer isn't downloading // a piece for the moment, the boost::optional // will be invalid. - boost::optional downloading_piece_progress() const TORRENT_OVERRIDE; + boost::optional downloading_piece_progress() const override; // this is const since it's used as a key in the web seed list in the torrent // if it's changed referencing back into that list will fail diff --git a/include/libtorrent/kademlia/dht_tracker.hpp b/include/libtorrent/kademlia/dht_tracker.hpp index d2f44cf82..98cab668b 100644 --- a/include/libtorrent/kademlia/dht_tracker.hpp +++ b/include/libtorrent/kademlia/dht_tracker.hpp @@ -67,7 +67,7 @@ namespace libtorrent { namespace dht { struct dht_tracker; - struct TORRENT_EXTRA_EXPORT dht_tracker TORRENT_FINAL + struct TORRENT_EXTRA_EXPORT dht_tracker final : udp_socket_interface , boost::enable_shared_from_this { @@ -147,8 +147,8 @@ namespace libtorrent { namespace dht void refresh_key(error_code const& e); // implements udp_socket_interface - virtual bool has_quota() TORRENT_OVERRIDE; - virtual bool send_packet(libtorrent::entry& e, udp::endpoint const& addr) TORRENT_OVERRIDE; + virtual bool has_quota() override; + virtual bool send_packet(libtorrent::entry& e, udp::endpoint const& addr) override; // this is the bdecode_node DHT messages are parsed into. It's a member // in order to avoid having to deallocate and re-allocate it for every diff --git a/include/libtorrent/kademlia/put_data.hpp b/include/libtorrent/kademlia/put_data.hpp index 1c4ece733..c4ab76436 100644 --- a/include/libtorrent/kademlia/put_data.hpp +++ b/include/libtorrent/kademlia/put_data.hpp @@ -57,8 +57,8 @@ struct put_data: traversal_algorithm put_data(node& node, put_callback const& callback); - virtual char const* name() const TORRENT_OVERRIDE; - virtual void start() TORRENT_OVERRIDE; + virtual char const* name() const override; + virtual void start() override; void set_data(item const& data) { m_data = data; } @@ -66,8 +66,8 @@ struct put_data: traversal_algorithm protected: - virtual void done() TORRENT_OVERRIDE; - virtual bool invoke(observer_ptr o) TORRENT_OVERRIDE; + virtual void done() override; + virtual bool invoke(observer_ptr o) override; put_callback m_put_callback; item m_data; diff --git a/include/libtorrent/pe_crypto.hpp b/include/libtorrent/pe_crypto.hpp index 7f6307e7e..666b41349 100644 --- a/include/libtorrent/pe_crypto.hpp +++ b/include/libtorrent/pe_crypto.hpp @@ -128,14 +128,14 @@ namespace libtorrent rc4_handler(); // Input keys must be 20 bytes - void set_incoming_key(unsigned char const* key, int len) TORRENT_OVERRIDE; - void set_outgoing_key(unsigned char const* key, int len) TORRENT_OVERRIDE; + void set_incoming_key(unsigned char const* key, int len) override; + void set_outgoing_key(unsigned char const* key, int len) override; - int encrypt(std::vector& buf) TORRENT_OVERRIDE; + int encrypt(std::vector& buf) override; void decrypt(std::vector& buf , int& consume , int& produce - , int& packet_size) TORRENT_OVERRIDE; + , int& packet_size) override; private: rc4 m_rc4_incoming; diff --git a/include/libtorrent/resolver.hpp b/include/libtorrent/resolver.hpp index 152f4309a..3553c97e5 100644 --- a/include/libtorrent/resolver.hpp +++ b/include/libtorrent/resolver.hpp @@ -52,14 +52,14 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { -struct TORRENT_EXTRA_EXPORT resolver TORRENT_FINAL : resolver_interface +struct TORRENT_EXTRA_EXPORT resolver final : resolver_interface { resolver(io_service& ios); virtual void async_resolve(std::string const& host, int flags - , callback_t const& h) TORRENT_OVERRIDE; + , callback_t const& h) override; - virtual void abort() TORRENT_OVERRIDE; + virtual void abort() override; private: diff --git a/include/libtorrent/storage.hpp b/include/libtorrent/storage.hpp index 50750859b..77b76abe6 100644 --- a/include/libtorrent/storage.hpp +++ b/include/libtorrent/storage.hpp @@ -399,27 +399,27 @@ namespace libtorrent ~default_storage(); #ifndef TORRENT_NO_DEPRECATE - void finalize_file(int file, storage_error& ec) TORRENT_OVERRIDE; + void finalize_file(int file, storage_error& ec) override; #endif - virtual bool has_any_file(storage_error& ec) TORRENT_OVERRIDE; + virtual bool has_any_file(storage_error& ec) override; virtual void set_file_priority(std::vector const& prio - , storage_error& ec) TORRENT_OVERRIDE; + , storage_error& ec) override; virtual void rename_file(int index, std::string const& new_filename - , storage_error& ec) TORRENT_OVERRIDE; - virtual void release_files(storage_error& ec) TORRENT_OVERRIDE; - virtual void delete_files(int options, storage_error& ec) TORRENT_OVERRIDE; - virtual void initialize(storage_error& ec) TORRENT_OVERRIDE; + , storage_error& ec) override; + virtual void release_files(storage_error& ec) override; + virtual void delete_files(int options, storage_error& ec) override; + virtual void initialize(storage_error& ec) override; virtual int move_storage(std::string const& save_path, int flags - , storage_error& ec) TORRENT_OVERRIDE; + , storage_error& ec) override; virtual bool verify_resume_data(add_torrent_params const& rd , std::vector const* links - , storage_error& error) TORRENT_OVERRIDE; - virtual bool tick() TORRENT_OVERRIDE; + , storage_error& error) override; + virtual bool tick() override; int readv(file::iovec_t const* bufs, int num_bufs - , int piece, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE; + , int piece, int offset, int flags, storage_error& ec) override; int writev(file::iovec_t const* bufs, int num_bufs - , int piece, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE; + , int piece, int offset, int flags, storage_error& ec) override; // if the files in this storage are mapped, returns the mapped // file_storage, otherwise returns the original file_storage object. @@ -478,52 +478,52 @@ namespace libtorrent // of normal bittorrent operation, since it will just send garbage // to peers and throw away all the data it downloads. It would end // up being banned immediately - class disabled_storage TORRENT_FINAL : public storage_interface, boost::noncopyable + class disabled_storage final : public storage_interface, boost::noncopyable { public: - virtual bool has_any_file(storage_error&) TORRENT_OVERRIDE { return false; } + virtual bool has_any_file(storage_error&) override { return false; } virtual void set_file_priority(std::vector const& - , storage_error&) TORRENT_OVERRIDE {} - virtual void rename_file(int, std::string const&, storage_error&) TORRENT_OVERRIDE {} - virtual void release_files(storage_error&) TORRENT_OVERRIDE {} - virtual void delete_files(int, storage_error&) TORRENT_OVERRIDE {} - virtual void initialize(storage_error&) TORRENT_OVERRIDE {} - virtual int move_storage(std::string const&, int, storage_error&) TORRENT_OVERRIDE { return 0; } + , storage_error&) override {} + virtual void rename_file(int, std::string const&, storage_error&) override {} + virtual void release_files(storage_error&) override {} + virtual void delete_files(int, storage_error&) override {} + virtual void initialize(storage_error&) override {} + virtual int move_storage(std::string const&, int, storage_error&) override { return 0; } virtual int readv(file::iovec_t const* bufs, int num_bufs, int piece - , int offset, int flags, storage_error& ec) TORRENT_OVERRIDE; + , int offset, int flags, storage_error& ec) override; virtual int writev(file::iovec_t const* bufs, int num_bufs, int piece - , int offset, int flags, storage_error& ec) TORRENT_OVERRIDE; + , int offset, int flags, storage_error& ec) override; virtual bool verify_resume_data(add_torrent_params const& , std::vector const* - , storage_error&) TORRENT_OVERRIDE { return false; } + , storage_error&) override { return false; } }; // this storage implementation always reads zeroes, and always discards // anything written to it - struct zero_storage TORRENT_FINAL : storage_interface + struct zero_storage final : storage_interface { - virtual void initialize(storage_error&) TORRENT_OVERRIDE {} + virtual void initialize(storage_error&) override {} virtual int readv(file::iovec_t const* bufs, int num_bufs - , int piece, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE; + , int piece, int offset, int flags, storage_error& ec) override; virtual int writev(file::iovec_t const* bufs, int num_bufs - , int piece, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE; + , int piece, int offset, int flags, storage_error& ec) override; - virtual bool has_any_file(storage_error&) TORRENT_OVERRIDE { return false; } + virtual bool has_any_file(storage_error&) override { return false; } virtual void set_file_priority(std::vector const& /* prio */ - , storage_error&) TORRENT_OVERRIDE {} + , storage_error&) override {} virtual int move_storage(std::string const& /* save_path */ - , int /* flags */, storage_error&) TORRENT_OVERRIDE { return 0; } + , int /* flags */, storage_error&) override { return 0; } virtual bool verify_resume_data(add_torrent_params const& /* rd */ , std::vector const* /* links */ - , storage_error&) TORRENT_OVERRIDE + , storage_error&) override { return false; } - virtual void release_files(storage_error&) TORRENT_OVERRIDE {} + virtual void release_files(storage_error&) override {} virtual void rename_file(int /* index */ - , std::string const& /* new_filenamem */, storage_error&) TORRENT_OVERRIDE {} - virtual void delete_files(int, storage_error&) TORRENT_OVERRIDE {} + , std::string const& /* new_filenamem */, storage_error&) override {} + virtual void delete_files(int, storage_error&) override {} }; struct disk_io_thread; diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 397f43cdb..1279365c2 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -673,14 +673,14 @@ namespace libtorrent tracker_request const& r , address const& tracker_ip , std::list
const& ip_list - , struct tracker_response const& resp) TORRENT_OVERRIDE; + , struct tracker_response const& resp) override; virtual void tracker_request_error(tracker_request const& r , int response_code, error_code const& ec, const std::string& msg - , int retry_interval) TORRENT_OVERRIDE; + , int retry_interval) override; virtual void tracker_warning(tracker_request const& req - , std::string const& msg) TORRENT_OVERRIDE; + , std::string const& msg) override; virtual void tracker_scrape_response(tracker_request const& req - , int complete, int incomplete, int downloaded, int downloaders) TORRENT_OVERRIDE; + , int complete, int incomplete, int downloaded, int downloaders) override; void update_scrape_state(); @@ -983,7 +983,7 @@ namespace libtorrent // LOGGING #ifndef TORRENT_DISABLE_LOGGING - virtual void debug_log(const char* fmt, ...) const TORRENT_OVERRIDE TORRENT_FORMAT(2,3); + virtual void debug_log(const char* fmt, ...) const override TORRENT_FORMAT(2,3); void log_to_all_peers(char const* message); time_point m_dht_start_time; diff --git a/include/libtorrent/torrent_peer_allocator.hpp b/include/libtorrent/torrent_peer_allocator.hpp index 697e10ea4..a2a258cc9 100644 --- a/include/libtorrent/torrent_peer_allocator.hpp +++ b/include/libtorrent/torrent_peer_allocator.hpp @@ -60,7 +60,7 @@ namespace libtorrent ~torrent_peer_allocator_interface() {} }; - struct TORRENT_EXTRA_EXPORT torrent_peer_allocator TORRENT_FINAL + struct TORRENT_EXTRA_EXPORT torrent_peer_allocator final : torrent_peer_allocator_interface { torrent_peer_allocator(); diff --git a/include/libtorrent/tracker_manager.hpp b/include/libtorrent/tracker_manager.hpp index c801c61a1..109c85fc5 100644 --- a/include/libtorrent/tracker_manager.hpp +++ b/include/libtorrent/tracker_manager.hpp @@ -336,7 +336,7 @@ namespace libtorrent tracker_manager& m_man; }; - class TORRENT_EXTRA_EXPORT tracker_manager TORRENT_FINAL + class TORRENT_EXTRA_EXPORT tracker_manager final : boost::noncopyable { public: diff --git a/include/libtorrent/utp_socket_manager.hpp b/include/libtorrent/utp_socket_manager.hpp index e1b508c44..c797e1be3 100644 --- a/include/libtorrent/utp_socket_manager.hpp +++ b/include/libtorrent/utp_socket_manager.hpp @@ -53,7 +53,7 @@ namespace libtorrent struct utp_socket_impl; struct counters; - struct utp_socket_manager TORRENT_FINAL + struct utp_socket_manager final { typedef boost::function diff --git a/include/libtorrent/web_peer_connection.hpp b/include/libtorrent/web_peer_connection.hpp index 6168debe1..f60e4db69 100644 --- a/include/libtorrent/web_peer_connection.hpp +++ b/include/libtorrent/web_peer_connection.hpp @@ -74,25 +74,25 @@ namespace libtorrent web_peer_connection(peer_connection_args const& pack , web_seed_t& web); - virtual void on_connected() TORRENT_OVERRIDE; + virtual void on_connected() override; - virtual int type() const TORRENT_OVERRIDE + virtual int type() const override { return peer_connection::url_seed_connection; } // called from the main loop when this connection has any // work to do. virtual void on_receive(error_code const& error - , std::size_t bytes_transferred) TORRENT_OVERRIDE; + , std::size_t bytes_transferred) override; - std::string const& url() const TORRENT_OVERRIDE { return m_url; } + std::string const& url() const override { return m_url; } - virtual void get_specific_peer_info(peer_info& p) const TORRENT_OVERRIDE; + virtual void get_specific_peer_info(peer_info& p) const override; virtual void disconnect(error_code const& ec - , operation_t op, int error = 0) TORRENT_OVERRIDE; + , operation_t op, int error = 0) override; - virtual void write_request(peer_request const& r) TORRENT_OVERRIDE; + virtual void write_request(peer_request const& r) override; - virtual bool received_invalid_data(int index, bool single_peer) TORRENT_OVERRIDE; + virtual bool received_invalid_data(int index, bool single_peer) override; private: @@ -108,7 +108,7 @@ namespace libtorrent // block. If the peer isn't downloading // a piece for the moment, the boost::optional // will be invalid. - boost::optional downloading_piece_progress() const TORRENT_OVERRIDE; + boost::optional downloading_piece_progress() const override; void handle_padfile(); diff --git a/simulation/test_dht_rate_limit.cpp b/simulation/test_dht_rate_limit.cpp index bff180f5f..4f9676faa 100644 --- a/simulation/test_dht_rate_limit.cpp +++ b/simulation/test_dht_rate_limit.cpp @@ -54,20 +54,20 @@ using namespace sim; struct obs : dht::dht_observer { virtual void set_external_address(address const& addr - , address const& source) TORRENT_OVERRIDE + , address const& source) override {} - virtual address external_address(udp proto) TORRENT_OVERRIDE + virtual address external_address(udp proto) override { if (proto == udp::v4()) return address_v4::from_string("40.30.20.10"); else return address_v6(); } - virtual void get_peers(sha1_hash const& ih) TORRENT_OVERRIDE {} + virtual void get_peers(sha1_hash const& ih) override {} virtual void outgoing_get_peers(sha1_hash const& target - , sha1_hash const& sent_target, udp::endpoint const& ep) TORRENT_OVERRIDE {} - virtual void announce(sha1_hash const& ih, address const& addr, int port) TORRENT_OVERRIDE {} - virtual void log(dht_logger::module_t l, char const* fmt, ...) TORRENT_OVERRIDE + , sha1_hash const& sent_target, udp::endpoint const& ep) override {} + virtual void announce(sha1_hash const& ih, address const& addr, int port) override {} + virtual void log(dht_logger::module_t l, char const* fmt, ...) override { va_list v; va_start(v, fmt); @@ -76,9 +76,9 @@ struct obs : dht::dht_observer puts("\n"); } virtual void log_packet(message_direction_t dir, char const* pkt, int len - , udp::endpoint node) TORRENT_OVERRIDE {} + , udp::endpoint node) override {} virtual bool on_dht_request(char const* query, int query_len - , dht::msg const& request, entry& response) TORRENT_OVERRIDE { return false; } + , dht::msg const& request, entry& response) override { return false; } }; #endif // #if !defined TORRENT_DISABLE_DHT diff --git a/src/kademlia/dht_storage.cpp b/src/kademlia/dht_storage.cpp index c59db9319..7a8ca7a12 100644 --- a/src/kademlia/dht_storage.cpp +++ b/src/kademlia/dht_storage.cpp @@ -183,7 +183,7 @@ namespace node_id const& m_our_id; }; - class dht_default_storage TORRENT_FINAL : public dht_storage_interface, boost::noncopyable + class dht_default_storage final : public dht_storage_interface, boost::noncopyable { typedef std::map table_t; typedef std::map dht_immutable_table_t; @@ -201,8 +201,8 @@ namespace ~dht_default_storage() {} #ifndef TORRENT_NO_DEPRECATE - size_t num_torrents() const TORRENT_OVERRIDE { return m_map.size(); } - size_t num_peers() const TORRENT_OVERRIDE + size_t num_torrents() const override { return m_map.size(); } + size_t num_peers() const override { int ret = 0; std::for_each(m_map.begin(), m_map.end(), count_peers(&ret)); @@ -212,7 +212,7 @@ namespace bool get_peers(sha1_hash const& info_hash , bool noseed, bool scrape - , entry& peers) const TORRENT_OVERRIDE + , entry& peers) const override { table_t::const_iterator i = m_map.lower_bound(info_hash); if (i == m_map.end()) return false; @@ -270,7 +270,7 @@ namespace void announce_peer(sha1_hash const& info_hash , tcp::endpoint const& endp - , std::string const& name, bool seed) TORRENT_OVERRIDE + , std::string const& name, bool seed) override { table_t::iterator ti = m_map.find(info_hash); torrent_entry* v; @@ -338,7 +338,7 @@ namespace } bool get_immutable_item(sha1_hash const& target - , entry& item) const TORRENT_OVERRIDE + , entry& item) const override { dht_immutable_table_t::const_iterator i = m_immutable_table.find(target); if (i == m_immutable_table.end()) return false; @@ -349,7 +349,7 @@ namespace void put_immutable_item(sha1_hash const& target , char const* buf, int size - , address const& addr) TORRENT_OVERRIDE + , address const& addr) override { dht_immutable_table_t::iterator i = m_immutable_table.find(target); if (i == m_immutable_table.end()) @@ -385,7 +385,7 @@ namespace } bool get_mutable_item_seq(sha1_hash const& target - , boost::int64_t& seq) const TORRENT_OVERRIDE + , boost::int64_t& seq) const override { dht_mutable_table_t::const_iterator i = m_mutable_table.find(target); if (i == m_mutable_table.end()) return false; @@ -396,7 +396,7 @@ namespace bool get_mutable_item(sha1_hash const& target , boost::int64_t seq, bool force_fill - , entry& item) const TORRENT_OVERRIDE + , entry& item) const override { dht_mutable_table_t::const_iterator i = m_mutable_table.find(target); if (i == m_mutable_table.end()) return false; @@ -418,7 +418,7 @@ namespace , boost::int64_t seq , char const* pk , char const* salt, int salt_size - , address const& addr) TORRENT_OVERRIDE + , address const& addr) override { dht_mutable_table_t::iterator i = m_mutable_table.find(target); if (i == m_mutable_table.end()) @@ -486,7 +486,7 @@ namespace touch_item(&i->second, addr); } - void tick() TORRENT_OVERRIDE + void tick() override { time_point now(aux::time_now()); @@ -541,7 +541,7 @@ namespace } } - virtual dht_storage_counters counters() const TORRENT_OVERRIDE + virtual dht_storage_counters counters() const override { return m_counters; } diff --git a/src/metadata_transfer.cpp b/src/metadata_transfer.cpp index d67148379..bd34ef082 100644 --- a/src/metadata_transfer.cpp +++ b/src/metadata_transfer.cpp @@ -97,7 +97,7 @@ namespace libtorrent { namespace return ret; } - struct metadata_plugin TORRENT_FINAL + struct metadata_plugin final : torrent_plugin { metadata_plugin(torrent& t) @@ -112,19 +112,19 @@ namespace libtorrent { namespace bool need_loaded() { return m_torrent.need_loaded(); } */ - virtual void on_unload() TORRENT_OVERRIDE + virtual void on_unload() override { m_metadata.reset(); } - virtual void on_load() TORRENT_OVERRIDE + virtual void on_load() override { // initialize m_metadata_size TORRENT_ASSERT(m_torrent.is_loaded()); metadata(); } - virtual void on_files_checked() TORRENT_OVERRIDE + virtual void on_files_checked() override { // if the torrent is a seed, make a reference to // the metadata from the torrent before it is deallocated @@ -132,7 +132,7 @@ namespace libtorrent { namespace } virtual boost::shared_ptr new_connection( - peer_connection_handle const& pc) TORRENT_OVERRIDE; + peer_connection_handle const& pc) override; buffer::const_interval metadata() const { @@ -219,7 +219,7 @@ namespace libtorrent { namespace m_torrent.set_progress_ppm(boost::int64_t(m_metadata_progress) * 1000000 / m_metadata_size); } - void on_piece_pass(int) TORRENT_OVERRIDE + void on_piece_pass(int) override { // if we became a seed, copy the metadata from // the torrent before it is deallocated @@ -257,7 +257,7 @@ namespace libtorrent { namespace metadata_plugin& operator=(metadata_plugin const&); }; - struct metadata_peer_plugin TORRENT_FINAL + struct metadata_peer_plugin final : peer_plugin { metadata_peer_plugin(torrent& t, peer_connection& pc @@ -272,17 +272,17 @@ namespace libtorrent { namespace , m_tp(tp) {} - virtual char const* type() const TORRENT_OVERRIDE { return "LT_metadata"; } + virtual char const* type() const override { return "LT_metadata"; } // can add entries to the extension handshake - virtual void add_handshake(entry& h) TORRENT_OVERRIDE + virtual void add_handshake(entry& h) override { entry& messages = h["m"]; messages["LT_metadata"] = 14; } // called when the extension handshake from the other end is received - virtual bool on_extension_handshake(bdecode_node const& h) TORRENT_OVERRIDE + virtual bool on_extension_handshake(bdecode_node const& h) override { m_message_index = 0; if (h.type() != bdecode_node::dict_t) return false; @@ -389,7 +389,7 @@ namespace libtorrent { namespace } virtual bool on_extended(int length - , int msg, buffer::const_interval body) TORRENT_OVERRIDE + , int msg, buffer::const_interval body) override { if (msg != 14) return false; if (m_message_index == 0) return false; @@ -491,7 +491,7 @@ namespace libtorrent { namespace return true; } - virtual void tick() TORRENT_OVERRIDE + virtual void tick() override { if (m_pc.is_disconnecting()) return; diff --git a/src/smart_ban.cpp b/src/smart_ban.cpp index 65b15d392..fff5c442b 100644 --- a/src/smart_ban.cpp +++ b/src/smart_ban.cpp @@ -118,7 +118,7 @@ namespace libtorrent { namespace { - struct smart_ban_plugin TORRENT_FINAL + struct smart_ban_plugin final : torrent_plugin , boost::enable_shared_from_this { @@ -136,7 +136,7 @@ namespace { fclose(m_log_file); } #endif - virtual void on_piece_pass(int p) TORRENT_OVERRIDE + virtual void on_piece_pass(int p) override { #ifndef TORRENT_DISABLE_LOGGING m_torrent.debug_log(" PIECE PASS [ p: %d | block_hash_size: %d ]" @@ -188,7 +188,7 @@ namespace } } - virtual void on_piece_failed(int p) TORRENT_OVERRIDE + virtual void on_piece_failed(int p) override { // The piece failed the hash check. Record // the CRC and origin peer of every block diff --git a/src/storage.cpp b/src/storage.cpp index b49f9dbae..81e98e622 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -234,7 +234,7 @@ namespace libtorrent , boost::int64_t const file_offset , int const size , file::iovec_t const* bufs, storage_error& ec) - TORRENT_OVERRIDE TORRENT_FINAL + override final { if (m_storage.files().pad_file_at(file_index)) { @@ -325,7 +325,7 @@ namespace libtorrent , boost::int64_t const file_offset , int const size , file::iovec_t const* bufs, storage_error& ec) - TORRENT_OVERRIDE TORRENT_FINAL + override final { int num_bufs = count_bufs(bufs, size); diff --git a/src/ut_metadata.cpp b/src/ut_metadata.cpp index 19c66b302..d704176a8 100644 --- a/src/ut_metadata.cpp +++ b/src/ut_metadata.cpp @@ -90,7 +90,7 @@ namespace libtorrent { namespace struct ut_metadata_peer_plugin; - struct ut_metadata_plugin TORRENT_FINAL + struct ut_metadata_plugin final : torrent_plugin { ut_metadata_plugin(torrent& t) @@ -106,19 +106,19 @@ namespace libtorrent { namespace bool need_loaded() { return m_torrent.need_loaded(); } - virtual void on_unload() TORRENT_OVERRIDE + virtual void on_unload() override { m_metadata.reset(); } - virtual void on_load() TORRENT_OVERRIDE + virtual void on_load() override { // initialize m_metadata_size TORRENT_ASSERT(m_torrent.is_loaded()); metadata(); } - virtual void on_files_checked() TORRENT_OVERRIDE + virtual void on_files_checked() override { // TODO: 2 if we were to initialize m_metadata_size lazily instead, // we would probably be more efficient @@ -127,7 +127,7 @@ namespace libtorrent { namespace } virtual boost::shared_ptr new_connection( - peer_connection_handle const& pc) TORRENT_OVERRIDE; + peer_connection_handle const& pc) override; int get_metadata_size() const { @@ -167,7 +167,7 @@ namespace libtorrent { namespace m_torrent.set_progress_ppm(boost::int64_t(m_metadata_progress) * 1000000 / m_metadata_size); } */ - void on_piece_pass(int) TORRENT_OVERRIDE + void on_piece_pass(int) override { // if we became a seed, copy the metadata from // the torrent before it is deallocated @@ -215,7 +215,7 @@ namespace libtorrent { namespace }; - struct ut_metadata_peer_plugin TORRENT_FINAL + struct ut_metadata_peer_plugin final : peer_plugin, boost::enable_shared_from_this { friend struct ut_metadata_plugin; @@ -229,10 +229,10 @@ namespace libtorrent { namespace , m_tp(tp) {} - virtual char const* type() const TORRENT_OVERRIDE { return "ut_metadata"; } + virtual char const* type() const override { return "ut_metadata"; } // can add entries to the extension handshake - virtual void add_handshake(entry& h) TORRENT_OVERRIDE + virtual void add_handshake(entry& h) override { entry& messages = h["m"]; messages["ut_metadata"] = 2; @@ -241,7 +241,7 @@ namespace libtorrent { namespace } // called when the extension handshake from the other end is received - virtual bool on_extension_handshake(bdecode_node const& h) TORRENT_OVERRIDE + virtual bool on_extension_handshake(bdecode_node const& h) override { m_message_index = 0; if (h.type() != bdecode_node::dict_t) return false; @@ -327,7 +327,7 @@ namespace libtorrent { namespace } virtual bool on_extended(int length - , int extended_msg, buffer::const_interval body) TORRENT_OVERRIDE + , int extended_msg, buffer::const_interval body) override { if (extended_msg != 2) return false; if (m_message_index == 0) return false; @@ -443,7 +443,7 @@ namespace libtorrent { namespace return true; } - virtual void tick() TORRENT_OVERRIDE + virtual void tick() override { maybe_send_request(); while (!m_incoming_requests.empty() diff --git a/src/ut_pex.cpp b/src/ut_pex.cpp index 230086dcc..253c0ce0b 100644 --- a/src/ut_pex.cpp +++ b/src/ut_pex.cpp @@ -81,7 +81,7 @@ namespace libtorrent { namespace return true; } - struct ut_pex_plugin TORRENT_FINAL + struct ut_pex_plugin final : torrent_plugin { // randomize when we rebuild the pex message @@ -94,7 +94,7 @@ namespace libtorrent { namespace , m_peers_in_message(0) {} virtual boost::shared_ptr new_connection( - peer_connection_handle const& pc) TORRENT_OVERRIDE; + peer_connection_handle const& pc) override; std::vector& get_ut_pex_msg() { @@ -111,7 +111,7 @@ namespace libtorrent { namespace // are calculated here and the pex message is created // each peer connection will use this message // max_peer_entries limits the packet size - virtual void tick() TORRENT_OVERRIDE + virtual void tick() override { time_point now = aux::time_now(); if (now - seconds(60) < m_last_msg) return; @@ -241,7 +241,7 @@ namespace libtorrent { namespace ut_pex_plugin& operator=(ut_pex_plugin const&); }; - struct ut_pex_peer_plugin TORRENT_FINAL + struct ut_pex_peer_plugin final : peer_plugin { ut_pex_peer_plugin(torrent& t, peer_connection& pc, ut_pex_plugin& tp) @@ -259,15 +259,15 @@ namespace libtorrent { namespace } } - virtual char const* type() const TORRENT_OVERRIDE { return "ut_pex"; } + virtual char const* type() const override { return "ut_pex"; } - virtual void add_handshake(entry& h) TORRENT_OVERRIDE + virtual void add_handshake(entry& h) override { entry& messages = h["m"]; messages[extension_name] = extension_index; } - virtual bool on_extension_handshake(bdecode_node const& h) TORRENT_OVERRIDE + virtual bool on_extension_handshake(bdecode_node const& h) override { m_message_index = 0; if (h.type() != bdecode_node::dict_t) return false; @@ -280,7 +280,7 @@ namespace libtorrent { namespace return true; } - virtual bool on_extended(int length, int msg, buffer::const_interval body) TORRENT_OVERRIDE + virtual bool on_extended(int length, int msg, buffer::const_interval body) override { if (msg != extension_index) return false; if (m_message_index == 0) return false; @@ -433,7 +433,7 @@ namespace libtorrent { namespace // the peers second tick // every minute we send a pex message - virtual void tick() TORRENT_OVERRIDE + virtual void tick() override { // no handshake yet if (!m_message_index) return; diff --git a/test/test_block_cache.cpp b/test/test_block_cache.cpp index b38c08780..06ee9213d 100644 --- a/test/test_block_cache.cpp +++ b/test/test_block_cache.cpp @@ -47,33 +47,33 @@ using namespace libtorrent; struct test_storage_impl : storage_interface { - virtual void initialize(storage_error& ec) TORRENT_OVERRIDE {} + virtual void initialize(storage_error& ec) override {} virtual int readv(file::iovec_t const* bufs, int num_bufs - , int piece, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE + , int piece, int offset, int flags, storage_error& ec) override { return bufs_size(bufs, num_bufs); } virtual int writev(file::iovec_t const* bufs, int num_bufs - , int piece, int offset, int flags, storage_error& ec) TORRENT_OVERRIDE + , int piece, int offset, int flags, storage_error& ec) override { return bufs_size(bufs, num_bufs); } - virtual bool has_any_file(storage_error& ec) TORRENT_OVERRIDE { return false; } + virtual bool has_any_file(storage_error& ec) override { return false; } virtual void set_file_priority(std::vector const& prio - , storage_error& ec) TORRENT_OVERRIDE {} + , storage_error& ec) override {} virtual int move_storage(std::string const& save_path, int flags - , storage_error& ec) TORRENT_OVERRIDE { return 0; } + , storage_error& ec) override { return 0; } virtual bool verify_resume_data(add_torrent_params const& rd , std::vector const* links - , storage_error& ec) TORRENT_OVERRIDE { return true; } - virtual void release_files(storage_error& ec) TORRENT_OVERRIDE {} + , storage_error& ec) override { return true; } + virtual void release_files(storage_error& ec) override {} virtual void rename_file(int index, std::string const& new_filenamem - , storage_error& ec) TORRENT_OVERRIDE {} - virtual void delete_files(int, storage_error& ec) TORRENT_OVERRIDE {} + , storage_error& ec) override {} + virtual void delete_files(int, storage_error& ec) override {} #ifndef TORRENT_NO_DEPRECATE - virtual void finalize_file(int, storage_error&) TORRENT_OVERRIDE {} + virtual void finalize_file(int, storage_error&) override {} #endif }; diff --git a/test/test_dht.cpp b/test/test_dht.cpp index c5bbec4a8..6b15b9d49 100644 --- a/test/test_dht.cpp +++ b/test/test_dht.cpp @@ -95,10 +95,10 @@ static void nop(void* userdata, libtorrent::dht::node_entry const& n) {} std::list > g_sent_packets; -struct mock_socket TORRENT_FINAL : udp_socket_interface +struct mock_socket final : udp_socket_interface { - bool has_quota() TORRENT_OVERRIDE { return true; } - bool send_packet(entry& msg, udp::endpoint const& ep) TORRENT_OVERRIDE + bool has_quota() override { return true; } + bool send_packet(entry& msg, udp::endpoint const& ep) override { // TODO: ideally the mock_socket would contain this queue of packets, to // make tests independent @@ -476,18 +476,18 @@ void put_immutable_item_cb(int num, int expect) struct obs : dht::dht_observer { virtual void set_external_address(address const& addr - , address const& source) TORRENT_OVERRIDE + , address const& source) override {} - virtual address external_address(udp proto) TORRENT_OVERRIDE + virtual address external_address(udp proto) override { return address_v4::from_string("236.0.0.1"); } - virtual void get_peers(sha1_hash const& ih) TORRENT_OVERRIDE {} + virtual void get_peers(sha1_hash const& ih) override {} virtual void outgoing_get_peers(sha1_hash const& target - , sha1_hash const& sent_target, udp::endpoint const& ep) TORRENT_OVERRIDE {} - virtual void announce(sha1_hash const& ih, address const& addr, int port) TORRENT_OVERRIDE {} - virtual void log(dht_logger::module_t l, char const* fmt, ...) TORRENT_OVERRIDE + , sha1_hash const& sent_target, udp::endpoint const& ep) override {} + virtual void announce(sha1_hash const& ih, address const& addr, int port) override {} + virtual void log(dht_logger::module_t l, char const* fmt, ...) override { va_list v; va_start(v, fmt); @@ -497,9 +497,9 @@ struct obs : dht::dht_observer m_log.push_back(buf); } virtual void log_packet(message_direction_t dir, char const* pkt, int len - , udp::endpoint node) TORRENT_OVERRIDE {} + , udp::endpoint node) override {} virtual bool on_dht_request(char const* query, int query_len - , dht::msg const& request, entry& response) TORRENT_OVERRIDE { return false; } + , dht::msg const& request, entry& response) override { return false; } std::vector m_log; }; diff --git a/test/test_dos_blocker.cpp b/test/test_dos_blocker.cpp index 3d0fdb267..95efe086c 100644 --- a/test/test_dos_blocker.cpp +++ b/test/test_dos_blocker.cpp @@ -45,7 +45,7 @@ using namespace libtorrent; struct log_t : libtorrent::dht::dht_logger { virtual void log(dht_logger::module_t m, char const* fmt, ...) - TORRENT_OVERRIDE TORRENT_FORMAT(3, 4) + override TORRENT_FORMAT(3, 4) { va_list v; va_start(v, fmt); @@ -54,7 +54,7 @@ struct log_t : libtorrent::dht::dht_logger } virtual void log_packet(message_direction_t dir, char const* pkt, int len - , udp::endpoint node) TORRENT_OVERRIDE + , udp::endpoint node) override { libtorrent::bdecode_node print; libtorrent::error_code ec;