mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-05 14:47:25 +03:00
parent
0ad65ceef6
commit
a311c259cc
2 changed files with 12 additions and 9 deletions
|
@ -1601,20 +1601,24 @@ void SessionImpl::endStartup(ResumeSessionContext *context)
|
|||
m_resumeDataTimer->start();
|
||||
}
|
||||
|
||||
m_wakeupCheckTimer = new QTimer(this);
|
||||
connect(m_wakeupCheckTimer, &QTimer::timeout, this, [this]
|
||||
auto wakeupCheckTimer = new QTimer(this);
|
||||
connect(wakeupCheckTimer, &QTimer::timeout, this, [this]
|
||||
{
|
||||
const auto now = std::chrono::steady_clock::now();
|
||||
if ((now - m_wakeupCheckTimestamp) > 100s)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 6, 0))
|
||||
const bool hasSystemSlept = m_wakeupCheckTimestamp.durationElapsed() > 100s;
|
||||
#else
|
||||
const bool hasSystemSlept = m_wakeupCheckTimestamp.elapsed() > std::chrono::milliseconds(100s).count();
|
||||
#endif
|
||||
if (hasSystemSlept)
|
||||
{
|
||||
LogMsg(tr("System wake-up event detected. Re-announcing to all the trackers..."));
|
||||
reannounceToAllTrackers();
|
||||
}
|
||||
|
||||
m_wakeupCheckTimestamp = now;
|
||||
m_wakeupCheckTimestamp.start();
|
||||
});
|
||||
m_wakeupCheckTimestamp = std::chrono::steady_clock::now();
|
||||
m_wakeupCheckTimer->start(30s);
|
||||
m_wakeupCheckTimestamp.start();
|
||||
wakeupCheckTimer->start(30s);
|
||||
|
||||
m_isRestored = true;
|
||||
emit startupProgressUpdated(100);
|
||||
|
|
|
@ -823,8 +823,7 @@ namespace BitTorrent
|
|||
bool m_isPortMappingEnabled = false;
|
||||
QHash<quint16, std::vector<lt::port_mapping_t>> m_mappedPorts;
|
||||
|
||||
QTimer *m_wakeupCheckTimer = nullptr;
|
||||
std::chrono::steady_clock::time_point m_wakeupCheckTimestamp;
|
||||
QElapsedTimer m_wakeupCheckTimestamp;
|
||||
|
||||
QList<TorrentImpl *> m_pendingFinishedTorrents;
|
||||
|
||||
|
|
Loading…
Reference in a new issue