mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-07 07:37:24 +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_resumeDataTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_wakeupCheckTimer = new QTimer(this);
|
auto wakeupCheckTimer = new QTimer(this);
|
||||||
connect(m_wakeupCheckTimer, &QTimer::timeout, this, [this]
|
connect(wakeupCheckTimer, &QTimer::timeout, this, [this]
|
||||||
{
|
{
|
||||||
const auto now = std::chrono::steady_clock::now();
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 6, 0))
|
||||||
if ((now - m_wakeupCheckTimestamp) > 100s)
|
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..."));
|
LogMsg(tr("System wake-up event detected. Re-announcing to all the trackers..."));
|
||||||
reannounceToAllTrackers();
|
reannounceToAllTrackers();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_wakeupCheckTimestamp = now;
|
m_wakeupCheckTimestamp.start();
|
||||||
});
|
});
|
||||||
m_wakeupCheckTimestamp = std::chrono::steady_clock::now();
|
m_wakeupCheckTimestamp.start();
|
||||||
m_wakeupCheckTimer->start(30s);
|
wakeupCheckTimer->start(30s);
|
||||||
|
|
||||||
m_isRestored = true;
|
m_isRestored = true;
|
||||||
emit startupProgressUpdated(100);
|
emit startupProgressUpdated(100);
|
||||||
|
|
|
@ -823,8 +823,7 @@ namespace BitTorrent
|
||||||
bool m_isPortMappingEnabled = false;
|
bool m_isPortMappingEnabled = false;
|
||||||
QHash<quint16, std::vector<lt::port_mapping_t>> m_mappedPorts;
|
QHash<quint16, std::vector<lt::port_mapping_t>> m_mappedPorts;
|
||||||
|
|
||||||
QTimer *m_wakeupCheckTimer = nullptr;
|
QElapsedTimer m_wakeupCheckTimestamp;
|
||||||
std::chrono::steady_clock::time_point m_wakeupCheckTimestamp;
|
|
||||||
|
|
||||||
QList<TorrentImpl *> m_pendingFinishedTorrents;
|
QList<TorrentImpl *> m_pendingFinishedTorrents;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue