From badeed374f9c65da83c0d5f16cab567afb8785b8 Mon Sep 17 00:00:00 2001 From: tearfur <46261767+tearfur@users.noreply.github.com> Date: Sun, 6 Aug 2023 01:37:33 +0800 Subject: [PATCH] fix: incorrect pex flags merge logic (#5876) --- libtransmission/peer-mgr.h | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/libtransmission/peer-mgr.h b/libtransmission/peer-mgr.h index 2f97fd1e6..03755f65c 100644 --- a/libtransmission/peer-mgr.h +++ b/libtransmission/peer-mgr.h @@ -291,16 +291,9 @@ public: // --- - constexpr void set_pex_flags(uint8_t pex_flags, bool merge_unsupported = false) noexcept + constexpr void set_pex_flags(uint8_t pex_flags) noexcept { - if (merge_unsupported) - { - pex_flags_ |= pex_flags; - } - else - { - pex_flags_ = pex_flags; - } + pex_flags_ = pex_flags; if ((pex_flags & ADDED_F_CONNECTABLE) != 0U) { @@ -434,7 +427,7 @@ public: found_at(that.from_best()); /* num_consecutive_fails_ is already the latest */ - set_pex_flags(that.pex_flags(), true); + pex_flags_ |= that.pex_flags_; if (that.is_banned()) {