From 9232dd30dc19881a9e80040df0d23c64a6cdf7be Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 21 May 2019 10:48:19 +0800 Subject: [PATCH 1/2] Sort function declarations --- src/base/bittorrent/torrenthandle.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/base/bittorrent/torrenthandle.h b/src/base/bittorrent/torrenthandle.h index 4ca151a34..a8b2c7ae9 100644 --- a/src/base/bittorrent/torrenthandle.h +++ b/src/base/bittorrent/torrenthandle.h @@ -360,23 +360,23 @@ namespace BitTorrent void updateState(); void updateTorrentInfo(); + void handleFastResumeRejectedAlert(const lt::fastresume_rejected_alert *p); + void handleFileCompletedAlert(const lt::file_completed_alert *p); + void handleFileRenamedAlert(const lt::file_renamed_alert *p); + void handleFileRenameFailedAlert(const lt::file_rename_failed_alert *p); + void handleMetadataReceivedAlert(const lt::metadata_received_alert *p); + void handleSaveResumeDataAlert(const lt::save_resume_data_alert *p); + void handleSaveResumeDataFailedAlert(const lt::save_resume_data_failed_alert *p); + void handleStatsAlert(const lt::stats_alert *p); void handleStorageMovedAlert(const lt::storage_moved_alert *p); void handleStorageMovedFailedAlert(const lt::storage_moved_failed_alert *p); - void handleTrackerReplyAlert(const lt::tracker_reply_alert *p); - void handleTrackerWarningAlert(const lt::tracker_warning_alert *p); - void handleTrackerErrorAlert(const lt::tracker_error_alert *p); void handleTorrentCheckedAlert(const lt::torrent_checked_alert *p); void handleTorrentFinishedAlert(const lt::torrent_finished_alert *p); void handleTorrentPausedAlert(const lt::torrent_paused_alert *p); void handleTorrentResumedAlert(const lt::torrent_resumed_alert *p); - void handleSaveResumeDataAlert(const lt::save_resume_data_alert *p); - void handleSaveResumeDataFailedAlert(const lt::save_resume_data_failed_alert *p); - void handleFastResumeRejectedAlert(const lt::fastresume_rejected_alert *p); - void handleFileRenamedAlert(const lt::file_renamed_alert *p); - void handleFileRenameFailedAlert(const lt::file_rename_failed_alert *p); - void handleFileCompletedAlert(const lt::file_completed_alert *p); - void handleMetadataReceivedAlert(const lt::metadata_received_alert *p); - void handleStatsAlert(const lt::stats_alert *p); + void handleTrackerErrorAlert(const lt::tracker_error_alert *p); + void handleTrackerReplyAlert(const lt::tracker_reply_alert *p); + void handleTrackerWarningAlert(const lt::tracker_warning_alert *p); void resume_impl(bool forced); bool isMoveInProgress() const; From 45bafab4e01132c535429df48ce377a3e2b15bef Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 27 May 2019 09:30:49 +0800 Subject: [PATCH 2/2] Log performance alerts from libtorrent --- src/base/bittorrent/session.cpp | 5 +++-- src/base/bittorrent/torrenthandle.cpp | 9 +++++++++ src/base/bittorrent/torrenthandle.h | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index c8ff8711b..879187c7a 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -385,8 +385,9 @@ Session::Session(QObject *parent) | lt::alert::tracker_notification | lt::alert::status_notification | lt::alert::ip_block_notification - | lt::alert::file_progress_notification - | lt::alert::stats_notification; + | lt::alert::performance_warning + | lt::alert::stats_notification + | lt::alert::file_progress_notification; const std::string peerId = lt::generate_fingerprint(PEER_ID, QBT_VERSION_MAJOR, QBT_VERSION_MINOR, QBT_VERSION_BUGFIX, QBT_VERSION_BUILD); lt::settings_pack pack; diff --git a/src/base/bittorrent/torrenthandle.cpp b/src/base/bittorrent/torrenthandle.cpp index 6466be288..e9b57070c 100644 --- a/src/base/bittorrent/torrenthandle.cpp +++ b/src/base/bittorrent/torrenthandle.cpp @@ -1835,6 +1835,12 @@ void TorrentHandle::handleMetadataReceivedAlert(const lt::metadata_received_aler } } +void TorrentHandle::handlePerformanceAlert(const lt::performance_alert *p) const +{ + LogMsg((tr("Performance alert: ") + QString::fromStdString(p->message())) + , Log::INFO); +} + void TorrentHandle::handleTempPathChanged() { adjustActualSavePath(); @@ -1907,6 +1913,9 @@ void TorrentHandle::handleAlert(const lt::alert *a) case lt::torrent_checked_alert::alert_type: handleTorrentCheckedAlert(static_cast(a)); break; + case lt::performance_alert::alert_type: + handlePerformanceAlert(static_cast(a)); + break; } } diff --git a/src/base/bittorrent/torrenthandle.h b/src/base/bittorrent/torrenthandle.h index a8b2c7ae9..2b2538095 100644 --- a/src/base/bittorrent/torrenthandle.h +++ b/src/base/bittorrent/torrenthandle.h @@ -365,6 +365,7 @@ namespace BitTorrent void handleFileRenamedAlert(const lt::file_renamed_alert *p); void handleFileRenameFailedAlert(const lt::file_rename_failed_alert *p); void handleMetadataReceivedAlert(const lt::metadata_received_alert *p); + void handlePerformanceAlert(const lt::performance_alert *p) const; void handleSaveResumeDataAlert(const lt::save_resume_data_alert *p); void handleSaveResumeDataFailedAlert(const lt::save_resume_data_failed_alert *p); void handleStatsAlert(const lt::stats_alert *p);