From ee4baa39c4d5f58678d9a0ba72726858364ac765 Mon Sep 17 00:00:00 2001 From: Thomas Piccirello Date: Tue, 1 Jul 2025 07:58:40 -0700 Subject: [PATCH] Skip reannounce if torrent is stopped This matches the behavior exhibited elsewhere, but was not consistently applied. --- src/gui/transferlistwidget.cpp | 7 +++++-- src/webui/api/torrentscontroller.cpp | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp index f78dd8481..3cc83cb59 100644 --- a/src/gui/transferlistwidget.cpp +++ b/src/gui/transferlistwidget.cpp @@ -650,8 +650,11 @@ void TransferListWidget::reannounceSelectedTorrents() { for (BitTorrent::Torrent *const torrent : asConst(getSelectedTorrents())) { - torrent->forceReannounce(); - torrent->forceDHTAnnounce(); + if (!torrent->isStopped()) + { + torrent->forceReannounce(); + torrent->forceDHTAnnounce(); + } } } diff --git a/src/webui/api/torrentscontroller.cpp b/src/webui/api/torrentscontroller.cpp index c0e4f777d..0574c8843 100644 --- a/src/webui/api/torrentscontroller.cpp +++ b/src/webui/api/torrentscontroller.cpp @@ -1621,9 +1621,12 @@ void TorrentsController::reannounceAction() const QStringList hashes {params()[u"hashes"_s].split(u'|')}; applyToTorrents(hashes, [](BitTorrent::Torrent *const torrent) { - torrent->forceReannounce(); - torrent->forceDHTAnnounce(); - }); + if (!torrent->isStopped()) + { + torrent->forceReannounce(); + torrent->forceDHTAnnounce(); + } + }); setResult(QString()); }