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,14 +4072,29 @@ bool SessionImpl::isPaused() const
void SessionImpl::pause() void SessionImpl::pause()
{ {
if (!m_isPaused) if (m_isPaused)
{ return;
if (isRestored())
m_nativeSession->pause();
m_isPaused = true; if (isRestored())
emit paused(); {
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() void SessionImpl::resume()