From 1cee69da6c4be4cc023dc8a8ae55e2b440d8cabe Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Sat, 19 Nov 2022 13:33:38 +0300 Subject: [PATCH] Don't miss to store metadata of new torrent PR #18033. --- src/base/bittorrent/sessionimpl.cpp | 2 ++ src/base/bittorrent/torrentimpl.cpp | 4 ++-- src/base/bittorrent/torrentimpl.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/base/bittorrent/sessionimpl.cpp b/src/base/bittorrent/sessionimpl.cpp index 9202a9c85..ac02c3397 100644 --- a/src/base/bittorrent/sessionimpl.cpp +++ b/src/base/bittorrent/sessionimpl.cpp @@ -5359,6 +5359,8 @@ TorrentImpl *SessionImpl::createTorrent(const lt::torrent_handle &nativeHandle, if (isRestored()) { + torrent->saveResumeData(lt::torrent_handle::save_info_dict); + // The following is useless for newly added magnet if (torrent->hasMetadata()) { diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index 6742a22ff..31a098991 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -690,9 +690,9 @@ bool TorrentImpl::needSaveResumeData() const return m_nativeStatus.need_save_resume; } -void TorrentImpl::saveResumeData() +void TorrentImpl::saveResumeData(lt::resume_data_flags_t flags) { - m_nativeHandle.save_resume_data(); + m_nativeHandle.save_resume_data(flags); m_session->handleTorrentSaveResumeDataRequested(this); } diff --git a/src/base/bittorrent/torrentimpl.h b/src/base/bittorrent/torrentimpl.h index 1ac355bce..d8947ba1b 100644 --- a/src/base/bittorrent/torrentimpl.h +++ b/src/base/bittorrent/torrentimpl.h @@ -245,7 +245,7 @@ namespace BitTorrent void handleStateUpdate(const lt::torrent_status &nativeStatus); void handleCategoryOptionsChanged(); void handleAppendExtensionToggled(); - void saveResumeData(); + void saveResumeData(lt::resume_data_flags_t flags = {}); void handleMoveStorageJobFinished(const Path &path, bool hasOutstandingJob); void fileSearchFinished(const Path &savePath, const PathList &fileNames); void updatePeerCount(const QString &trackerURL, const TrackerEntry::Endpoint &endpoint, int count);