Browse Source

Prevent incorrect log message about torrent content deletion

PR #18692.
Closes #18689.
adaptive-webui-19844
Vladimir Golovnev 2 years ago committed by GitHub
parent
commit
9ef23d524d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      src/base/bittorrent/sessionimpl.cpp

9
src/base/bittorrent/sessionimpl.cpp

@ -5407,10 +5407,13 @@ void SessionImpl::handleTorrentDeletedAlert(const lt::torrent_deleted_alert *p) @@ -5407,10 +5407,13 @@ void SessionImpl::handleTorrentDeletedAlert(const lt::torrent_deleted_alert *p)
#endif
const auto removingTorrentDataIter = m_removingTorrents.find(id);
if (removingTorrentDataIter == m_removingTorrents.end())
return;
// torrent_deleted_alert can also be posted due to deletion of partfile. Ignore it in such a case.
if (removingTorrentDataIter->deleteOption == DeleteTorrent)
return;
Utils::Fs::smartRemoveEmptyFolderTree(removingTorrentDataIter->pathToRemove);
LogMsg(tr("Removed torrent and deleted its content. Torrent: \"%1\"").arg(removingTorrentDataIter->name));
m_removingTorrents.erase(removingTorrentDataIter);
@ -5425,7 +5428,6 @@ void SessionImpl::handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed @@ -5425,7 +5428,6 @@ void SessionImpl::handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed
#endif
const auto removingTorrentDataIter = m_removingTorrents.find(id);
if (removingTorrentDataIter == m_removingTorrents.end())
return;
@ -5435,7 +5437,7 @@ void SessionImpl::handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed @@ -5435,7 +5437,7 @@ void SessionImpl::handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed
// so we remove the directory ourselves
Utils::Fs::smartRemoveEmptyFolderTree(removingTorrentDataIter->pathToRemove);
LogMsg(tr("Removed torrent but failed to delete its content. Torrent: \"%1\". Error: \"%2\"")
LogMsg(tr("Removed torrent but failed to delete its content and/or partfile. Torrent: \"%1\". Error: \"%2\"")
.arg(removingTorrentDataIter->name, QString::fromLocal8Bit(p->error.message().c_str()))
, Log::WARNING);
}
@ -5443,6 +5445,7 @@ void SessionImpl::handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed @@ -5443,6 +5445,7 @@ void SessionImpl::handleTorrentDeleteFailedAlert(const lt::torrent_delete_failed
{
LogMsg(tr("Removed torrent. Torrent: \"%1\"").arg(removingTorrentDataIter->name));
}
m_removingTorrents.erase(removingTorrentDataIter);
}

Loading…
Cancel
Save