mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-26 01:38:20 +03:00
Suppress multiple I/O errors for the same torrent
When a file error happens libtorrent spews a ton of `file_error_alert` which result in log floods and notification balloon floods. The later might render the program inaccessible because the constant notifications prevent the user from interacting with the tray icon. Closes #8934
This commit is contained in:
parent
a446597597
commit
0a8925dc75
2 changed files with 18 additions and 4 deletions
|
@ -370,11 +370,16 @@ Session::Session(QObject *parent)
|
||||||
, m_numResumeData(0)
|
, m_numResumeData(0)
|
||||||
, m_extraLimit(0)
|
, m_extraLimit(0)
|
||||||
, m_useProxy(false)
|
, m_useProxy(false)
|
||||||
|
, m_recentErroredTorrentsTimer(new QTimer(this))
|
||||||
{
|
{
|
||||||
Logger *const logger = Logger::instance();
|
Logger *const logger = Logger::instance();
|
||||||
|
|
||||||
initResumeFolder();
|
initResumeFolder();
|
||||||
|
|
||||||
|
m_recentErroredTorrentsTimer->setSingleShot(true);
|
||||||
|
m_recentErroredTorrentsTimer->setInterval(1000);
|
||||||
|
connect(m_recentErroredTorrentsTimer, &QTimer::timeout, this, [this]() { m_recentErroredTorrents.clear(); });
|
||||||
|
|
||||||
m_seedingLimitTimer = new QTimer(this);
|
m_seedingLimitTimer = new QTimer(this);
|
||||||
m_seedingLimitTimer->setInterval(10000);
|
m_seedingLimitTimer->setInterval(10000);
|
||||||
connect(m_seedingLimitTimer, &QTimer::timeout, this, &Session::processShareLimits);
|
connect(m_seedingLimitTimer, &QTimer::timeout, this, &Session::processShareLimits);
|
||||||
|
@ -4184,10 +4189,15 @@ void Session::handleFileErrorAlert(libt::file_error_alert *p)
|
||||||
// NOTE: Check this function!
|
// NOTE: Check this function!
|
||||||
TorrentHandle *const torrent = m_torrents.value(p->handle.info_hash());
|
TorrentHandle *const torrent = m_torrents.value(p->handle.info_hash());
|
||||||
if (torrent) {
|
if (torrent) {
|
||||||
QString msg = QString::fromStdString(p->message());
|
const InfoHash hash = torrent->hash();
|
||||||
Logger::instance()->addMessage(tr("An I/O error occurred, '%1' paused. %2")
|
if (!m_recentErroredTorrents.contains(hash)) {
|
||||||
.arg(torrent->name(), msg));
|
m_recentErroredTorrents.insert(hash);
|
||||||
emit fullDiskError(torrent, msg);
|
const QString msg = QString::fromStdString(p->message());
|
||||||
|
LogMsg(tr("An I/O error occurred, '%1' paused. %2").arg(torrent->name(), msg));
|
||||||
|
emit fullDiskError(torrent, msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_recentErroredTorrentsTimer->start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -761,6 +761,10 @@ namespace BitTorrent
|
||||||
QStringMap m_categories;
|
QStringMap m_categories;
|
||||||
QSet<QString> m_tags;
|
QSet<QString> m_tags;
|
||||||
|
|
||||||
|
// I/O errored torrents
|
||||||
|
QSet<InfoHash> m_recentErroredTorrents;
|
||||||
|
QTimer *m_recentErroredTorrentsTimer;
|
||||||
|
|
||||||
#if LIBTORRENT_VERSION_NUM < 10100
|
#if LIBTORRENT_VERSION_NUM < 10100
|
||||||
QMutex m_alertsMutex;
|
QMutex m_alertsMutex;
|
||||||
QWaitCondition m_alertsWaitCondition;
|
QWaitCondition m_alertsWaitCondition;
|
||||||
|
|
Loading…
Reference in a new issue