From 623210df58b8d587caedbbec5b8d9ec4127f569f Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sat, 15 Jun 2019 22:21:26 +0800 Subject: [PATCH] Improve handleFileErrorAlert error message --- src/base/bittorrent/session.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/base/bittorrent/session.cpp b/src/base/bittorrent/session.cpp index 826b3719a..2cc9ad11b 100644 --- a/src/base/bittorrent/session.cpp +++ b/src/base/bittorrent/session.cpp @@ -4002,20 +4002,23 @@ void Session::handleMetadataReceivedAlert(const lt::metadata_received_alert *p) void Session::handleFileErrorAlert(const lt::file_error_alert *p) { - qDebug() << Q_FUNC_INFO; - // NOTE: Check this function! TorrentHandle *const torrent = m_torrents.value(p->handle.info_hash()); - if (torrent) { - const InfoHash hash = torrent->hash(); - if (!m_recentErroredTorrents.contains(hash)) { - m_recentErroredTorrents.insert(hash); - 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); - } + if (!torrent) + return; - m_recentErroredTorrentsTimer->start(); + const InfoHash hash = torrent->hash(); + + if (!m_recentErroredTorrents.contains(hash)) { + m_recentErroredTorrents.insert(hash); + + const QString msg = QString::fromStdString(p->message()); + LogMsg(tr("File error alert. Torrent: \"%1\". File: \"%2\". Reason: %3") + .arg(torrent->name(), p->filename(), msg) + , Log::WARNING); + emit fullDiskError(torrent, msg); } + + m_recentErroredTorrentsTimer->start(); } void Session::handlePortmapWarningAlert(const lt::portmap_error_alert *p)