From baa0c8533ac041dfda71d05fee8ef535bfdc9398 Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 24 Sep 2026 22:15:25 -0400 Subject: [PATCH] return more flags in flagStr --- libi2pd_client/TorrentsRPC.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libi2pd_client/TorrentsRPC.cpp b/libi2pd_client/TorrentsRPC.cpp index d46042f0..7dfe7fb7 100644 --- a/libi2pd_client/TorrentsRPC.cpp +++ b/libi2pd_client/TorrentsRPC.cpp @@ -425,7 +425,6 @@ namespace torrents std::string flags; auto stream = it->GetStream (); bool isIncoming = stream ? stream->IsIncoming () : false; - if (isIncoming) flags.push_back ('I'); auto identHashStr = stream ? stream->GetRemoteIdentity ()->GetIdentHash ().ToBase64 () : ""; peer["address"] = identHashStr.substr (0, 4); peer["port"] = TORRENT_PORT; @@ -440,6 +439,19 @@ namespace torrents peer["peerIsChoked"] = it->IsRemoteChoked (); peer["clientIsIntersted"] = it->IsInterested (); peer["peerIsInterested"] = it->IsRemoteInterested (); + if (it->IsDownloading ()) + flags.push_back ('D'); + else if (it->IsInterested ()) + flags.push_back ('d'); + else if (!it->IsChoked ()) + flags.push_back ('K'); + if (it->IsUploading ()) + flags.push_back ('U'); + else if (it->IsRemoteInterested ()) + flags.push_back ('u'); + else if (!it->IsRemoteChoked ()) + flags.push_back ('?'); + if (isIncoming) flags.push_back ('I'); peer["flagStr"] = flags; const auto& remoteBitfield = it->GetRemoteBitfield (); peer["progress"] = remoteBitfield.size () ? ((float)remoteBitfield.count ())/((float)remoteBitfield.size ()) : 0.0;