Reset tracker entries when pause the session

PR #21738.
This commit is contained in:
Vladimir Golovnev 2024-11-04 16:27:21 +03:00 committed by GitHub
parent c02f80cec5
commit b462a2bf0c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4072,15 +4072,30 @@ bool SessionImpl::isPaused() const
void SessionImpl::pause()
{
if (!m_isPaused)
{
if (m_isPaused)
return;
if (isRestored())
{
m_nativeSession->pause();
for (TorrentImpl *torrent : asConst(m_torrents))
{
torrent->resetTrackerEntryStatuses();
const QList<TrackerEntryStatus> trackers = torrent->trackers();
QHash<QString, TrackerEntryStatus> updatedTrackers;
updatedTrackers.reserve(trackers.size());
for (const TrackerEntryStatus &status : trackers)
updatedTrackers.emplace(status.url, status);
emit trackerEntryStatusesUpdated(torrent, updatedTrackers);
}
}
m_isPaused = true;
emit paused();
}
}
void SessionImpl::resume()
{