From 37a6a47ea32ae213d02dcb1b1915269ad70e8805 Mon Sep 17 00:00:00 2001 From: arvidn Date: Wed, 11 Jul 2018 12:44:25 +0200 Subject: [PATCH] minor cleanups around saving resume data --- examples/client_test.cpp | 9 ++------- include/libtorrent/torrent_handle.hpp | 3 +-- src/read_resume_data.cpp | 2 ++ 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/examples/client_test.cpp b/examples/client_test.cpp index ba33b592f..f216ed62d 100644 --- a/examples/client_test.cpp +++ b/examples/client_test.cpp @@ -1306,10 +1306,6 @@ example alert_masks: continue; } - // we're loading this torrent from resume data. There's no need to - // re-save the resume data immediately. - p.flags &= ~lt::torrent_flags::need_save_resume; - ses.async_add_torrent(std::move(p)); } } @@ -1960,9 +1956,8 @@ COLUMN OPTIONS std::vector const temp = ses.get_torrent_status( [](torrent_status const& st) { - if (!st.handle.is_valid()) return false; - if (!st.has_metadata) return false; - if (!st.need_save_resume) return false; + if (!st.handle.is_valid() || !st.has_metadata || !st.need_save_resume) + return false; return true; }, {}); diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index 9c2b7ea37..e7d42bd04 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -693,8 +693,7 @@ TORRENT_IPV6_NAMESPACE_END // torrent_handle& h = *i; // if (!h.is_valid()) continue; // torrent_status s = h.status(); - // if (!s.has_metadata) continue; - // if (!s.need_save_resume_data()) continue; + // if (!s.has_metadata || !s.need_save_resume_data()) continue; // // h.save_resume_data(); // ++outstanding_resume_data; diff --git a/src/read_resume_data.cpp b/src/read_resume_data.cpp index b55af61b0..da6d95189 100644 --- a/src/read_resume_data.cpp +++ b/src/read_resume_data.cpp @@ -342,6 +342,8 @@ namespace { } } + // we're loading this torrent from resume data. There's no need to + // re-save the resume data immediately. ret.flags &= ~torrent_flags::need_save_resume; return ret;