From 49f4c604daeaec1858cdbf503b3e3764793ab95b Mon Sep 17 00:00:00 2001 From: Yat Ho Date: Sat, 9 Nov 2024 02:42:59 +0800 Subject: [PATCH] fix: don't increment failure count when stopping torrent (#7238) * fix: don't increment failure count when stopping torrent * refactor: don't reset failure count on torrent stop --- libtransmission/peer-mgr.h | 4 ++-- libtransmission/peer-msgs.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libtransmission/peer-mgr.h b/libtransmission/peer-mgr.h index 9d707b002..34f41fcb8 100644 --- a/libtransmission/peer-mgr.h +++ b/libtransmission/peer-mgr.h @@ -233,7 +233,7 @@ public: // --- - constexpr auto set_connected(time_t now, bool is_connected = true) noexcept + constexpr auto set_connected(time_t now, bool is_connected = true, bool is_disconnecting = false) noexcept { if (is_connected_ == is_connected) { @@ -252,7 +252,7 @@ public: { num_consecutive_fruitless_ = {}; } - else + else if (is_disconnecting) { on_fruitless_connection(); } diff --git a/libtransmission/peer-msgs.cc b/libtransmission/peer-msgs.cc index 5aa6e71ce..52690c59f 100644 --- a/libtransmission/peer-msgs.cc +++ b/libtransmission/peer-msgs.cc @@ -2094,7 +2094,7 @@ tr_peerMsgs::tr_peerMsgs( tr_peerMsgs::~tr_peerMsgs() { - peer_info->set_connected(tr_time(), false); + peer_info->set_connected(tr_time(), false, is_disconnecting()); TR_ASSERT(n_peers > 0U); --n_peers; }