diff --git a/sources/functions/rtorrent b/sources/functions/rtorrent index eb5deb3a6..03648ebfd 100644 --- a/sources/functions/rtorrent +++ b/sources/functions/rtorrent @@ -201,8 +201,6 @@ function build_libtorrent_rakshasa() { patch -p1 < /etc/swizzin/sources/patches/rtorrent/libtorrent-scanf-0.13.8.patch >> "$log" 2>&1 patch -p1 < /etc/swizzin/sources/patches/rtorrent/lookup-cache-0.13.8.patch >> "$log" 2>&1 fi - #apply piece boundary fix to all libtorrents - patch -p1 < /etc/swizzin/sources/patches/rtorrent/piece-boundary-fix-0.13.8.patch >> "$log" 2>&1 if [[ ${libtorrentver} =~ ^("0.13.7"|"0.13.8")$ ]]; then patch -p1 < /etc/swizzin/sources/patches/rtorrent/throttle-fix-0.13.7-8.patch >> "$log" 2>&1 fi diff --git a/sources/patches/rtorrent/piece-boundary-fix-0.13.8.patch b/sources/patches/rtorrent/piece-boundary-fix-0.13.8.patch deleted file mode 100644 index 3f217e194..000000000 --- a/sources/patches/rtorrent/piece-boundary-fix-0.13.8.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 4bce4ac4a6c28da2cbd54d9be43e3eeec208a38e Mon Sep 17 00:00:00 2001 -From: stickz -Date: Thu, 28 Sep 2023 15:06:51 -0400 -Subject: [PATCH] piece boundary fix - -Resolves various bugs with torrent progress reporting. ---- - src/torrent/data/file.h | 1 + - src/torrent/data/file_list.cc | 9 +++++---- - 2 files changed, 6 insertions(+), 4 deletions(-) - -diff --git a/src/torrent/data/file.h b/src/torrent/data/file.h -index 4c58994bd..0238388c2 100644 ---- a/src/torrent/data/file.h -+++ b/src/torrent/data/file.h -@@ -78,6 +78,7 @@ class LIBTORRENT_EXPORT lt_cacheline_aligned File { - bool has_permissions(int prot) const { return !(prot & ~m_protection); } - - uint64_t offset() const { return m_offset; } -+ uint64_t offset_end() const { return m_offset + m_size; } - - uint64_t size_bytes() const { return m_size; } - uint32_t size_chunks() const { return m_range.second - m_range.first; } -diff --git a/src/torrent/data/file_list.cc b/src/torrent/data/file_list.cc -index 4721bdbd6..859cad08f 100644 ---- a/src/torrent/data/file_list.cc -+++ b/src/torrent/data/file_list.cc -@@ -676,15 +676,16 @@ FileList::mark_completed(uint32_t index) { - - FileList::iterator - FileList::inc_completed(iterator firstItr, uint32_t index) { -- firstItr = std::find_if(firstItr, end(), rak::less(index, std::mem_fun(&File::range_second))); -- iterator lastItr = std::find_if(firstItr, end(), rak::less(index + 1, std::mem_fun(&File::range_second))); -+ firstItr = std::find_if(firstItr, end(), rak::less(index, std::mem_fun(&File::range_second))); - - if (firstItr == end()) - throw internal_error("FileList::inc_completed() first == m_entryList->end().", data()->hash()); - -- // TODO: Check if this works right for zero-length files. -+ uint64_t boundary = (index+1)*m_chunkSize; -+ iterator lastItr = std::find_if(firstItr, end(), rak::less_equal(boundary, std::mem_fun(&File::offset_end))); -+ - std::for_each(firstItr, -- lastItr == end() ? end() : (lastItr + 1), -+ lastItr == end() ? end() : lastItr + 1, - std::mem_fun(&File::inc_completed_protected)); - - return lastItr;