From d5a6c93d3dfe42985073fc86df894927707ae7db Mon Sep 17 00:00:00 2001 From: orignal Date: Sat, 12 Sep 2026 11:01:34 -0400 Subject: [PATCH] close all active seesions on stop. Check if .part file exists before renaming --- libi2pd_client/TorrentsTunnel.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libi2pd_client/TorrentsTunnel.cpp b/libi2pd_client/TorrentsTunnel.cpp index 1de0ff8c..30a6a3bb 100644 --- a/libi2pd_client/TorrentsTunnel.cpp +++ b/libi2pd_client/TorrentsTunnel.cpp @@ -84,6 +84,7 @@ namespace torrents m_KeepAliveCheckTimer.cancel (); m_ReconnectCheckTimer.cancel (); m_TorrentsStatusUpdateTimer.cancel (); + i2p::client::I2PService::ClearHandlers (); // close connections for (auto it: m_Torrents) RequestTorrentTrackers (it.second, eTrackerAnnounceEventStopped); m_Torrents.clear (); @@ -243,11 +244,16 @@ namespace torrents { auto partFilePath = torrent->GetFullPath (); partFilePath += ".part"; std::error_code ec; - std::filesystem::rename (partFilePath, torrent->GetFullPath (), ec); - if (!ec) + if (std::filesystem::exists (partFilePath)) + { + std::filesystem::rename (partFilePath, torrent->GetFullPath (), ec); + if (!ec) + completed = true; + else + LogPrint (eLogError, "TorrentsTunnel: Can't rename ", partFilePath); + } + else if (std::filesystem::exists (torrent->GetFullPath ())) completed = true; - else - LogPrint (eLogError, "TorrentsTunnel: Can't rename ", partFilePath); } else {