From cb8d6a09395e2e3e81bff1bf9ff04dd3da9d81bb Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Sun, 18 Apr 2021 03:35:49 +0800 Subject: [PATCH] Reorder peer flags Now we group related flags nearby. --- src/base/bittorrent/peerinfo.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/base/bittorrent/peerinfo.cpp b/src/base/bittorrent/peerinfo.cpp index d09b9e55a..8d8c05f2a 100644 --- a/src/base/bittorrent/peerinfo.cpp +++ b/src/base/bittorrent/peerinfo.cpp @@ -291,6 +291,14 @@ void PeerInfo::determineFlags() } } + // K = Peer is unchoking your client, but your client is not interested + if (!isRemoteChocked() && !isInteresting()) + updateFlags(QLatin1Char('K'), tr("Not interested (local) and unchoked (peer)")); + + // ? = Your client unchoked the peer but the peer is not interested + if (!isChocked() && !isRemoteInterested()) + updateFlags(QLatin1Char('?'), tr("Not interested (peer) and unchoked (local)")); + // O = Optimistic unchoke if (optimisticUnchoke()) updateFlags(QLatin1Char('O'), tr("Optimistic unchoke")); @@ -303,21 +311,17 @@ void PeerInfo::determineFlags() if (!isLocalConnection()) updateFlags(QLatin1Char('I'), tr("Incoming connection")); - // K = Peer is unchoking your client, but your client is not interested - if (!isRemoteChocked() && !isInteresting()) - updateFlags(QLatin1Char('K'), tr("Not interested (local) and unchoked (peer)")); - - // ? = Your client unchoked the peer but the peer is not interested - if (!isChocked() && !isRemoteInterested()) - updateFlags(QLatin1Char('?'), tr("Not interested (peer) and unchoked (local)")); + // H = Peer was obtained through DHT + if (fromDHT()) + updateFlags(QLatin1Char('H'), tr("Peer from DHT")); // X = Peer was included in peerlists obtained through Peer Exchange (PEX) if (fromPeX()) updateFlags(QLatin1Char('X'), tr("Peer from PEX")); - // H = Peer was obtained through DHT - if (fromDHT()) - updateFlags(QLatin1Char('H'), tr("Peer from DHT")); + // L = Peer is local + if (fromLSD()) + updateFlags(QLatin1Char('L'), tr("Peer from LSD")); // E = Peer is using Protocol Encryption (all traffic) if (isRC4Encrypted()) @@ -331,10 +335,6 @@ void PeerInfo::determineFlags() if (useUTPSocket()) updateFlags(QLatin1Char('P'), QString::fromUtf8(C_UTP)); - // L = Peer is local - if (fromLSD()) - updateFlags(QLatin1Char('L'), tr("Peer from LSD")); - m_flags.chop(1); m_flagsDescription.chop(1); }