From b0daa69aa8517b1ac5e6defbc2a3f6c83b0c5d68 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sun, 3 May 2020 20:52:44 +0200 Subject: [PATCH] when stopping torrents, only abort hash jobs from a full check. Those jobs are likely to have deep queues and to benefit from being cancelled. Other hash jobs from downloading pieces cannot be restarted and should not be cancelled --- src/disk_io_thread.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp index bdd57cb5d..e1b3f40f2 100644 --- a/src/disk_io_thread.cpp +++ b/src/disk_io_thread.cpp @@ -1896,6 +1896,11 @@ constexpr disk_job_flags_t disk_interface::cache_hit; { disk_io_job *j = i.get(); if (j->storage != st) continue; + // only cancel volatile-read jobs. This means only full checking + // jobs. These jobs are likely to have a pretty deep queue and + // really gain from being cancelled. They can also be restarted + // easily. + if (!(j->flags & disk_interface::volatile_read)) continue; j->flags |= disk_io_job::aborted; } }