Merge pull request #11085 from Chocobo1/model

Better on-demand reloading of torrent data
This commit is contained in:
Mike Tzou 2019-08-30 12:45:57 +08:00 committed by GitHub
commit 62a3938480
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 95 additions and 73 deletions

View file

@ -4354,6 +4354,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);
@ -4361,6 +4364,7 @@ void Session::handleStateUpdateAlert(const lt::state_update_alert *p)
continue;
torrent->handleStateUpdate(status);
updatedTorrents.push_back(torrent);
}
m_torrentStatusReport = TorrentStatusReport();
@ -4383,7 +4387,7 @@ void Session::handleStateUpdateAlert(const lt::state_update_alert *p)
++m_torrentStatusReport.nbErrored;
}
emit torrentsUpdated();
emit torrentsUpdated(updatedTorrents);
}
namespace