Better on-demand reloading of torrent data

This commit is contained in:
Chocobo1
2019-08-17 14:58:10 +08:00
parent d639c16f72
commit 1f3bf75fff
4 changed files with 18 additions and 5 deletions

View File

@@ -4376,6 +4376,9 @@ void Session::handleSessionStatsAlert(const lt::session_stats_alert *p)
void Session::handleStateUpdateAlert(const lt::state_update_alert *p)
{
QVector<BitTorrent::TorrentHandle *> updatedTorrents;
updatedTorrents.reserve(p->status.size());
for (const lt::torrent_status &status : p->status) {
TorrentHandle *const torrent = m_torrents.value(status.info_hash);
@@ -4383,6 +4386,7 @@ void Session::handleStateUpdateAlert(const lt::state_update_alert *p)
continue;
torrent->handleStateUpdate(status);
updatedTorrents.push_back(torrent);
}
m_torrentStatusReport = TorrentStatusReport();
@@ -4405,7 +4409,7 @@ void Session::handleStateUpdateAlert(const lt::state_update_alert *p)
++m_torrentStatusReport.nbErrored;
}
emit torrentsUpdated();
emit torrentsUpdated(updatedTorrents);
}
namespace