@@ -303,7 +303,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
303
303
static constexpr int8_t NET_I2P{3 }; // pos of "i2p" in m_networks
304
304
static constexpr uint8_t m_networks_size{4 };
305
305
const std::array<std::string, m_networks_size> m_networks{{" ipv4" , " ipv6" , " onion" , " i2p" }};
306
- std::array<std::array<uint16_t , m_networks_size + 2 >, 3 > m_counts{{{}}}; // !< Peer counts by (in/out/total, networks/total/block-relay)
306
+ std::array<std::array<uint16_t , m_networks_size + 1 >, 3 > m_counts{{{}}}; // !< Peer counts by (in/out/total, networks/total)
307
+ uint8_t m_block_relay_peers_count{0 };
307
308
uint8_t m_manual_peers_count{0 };
308
309
int8_t NetworkStringToId (const std::string& str) const
309
310
{
@@ -478,10 +479,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
478
479
++m_counts.at (is_outbound).at (m_networks_size); // in/out overall
479
480
++m_counts.at (2 ).at (network_id); // total by network
480
481
++m_counts.at (2 ).at (m_networks_size); // total overall
481
- if (conn_type == " block-relay-only" ) {
482
- ++m_counts.at (is_outbound).at (m_networks_size + 1 ); // in/out block-relay
483
- ++m_counts.at (2 ).at (m_networks_size + 1 ); // total block-relay
484
- }
482
+ if (conn_type == " block-relay-only" ) ++m_block_relay_peers_count;
485
483
if (conn_type == " manual" ) ++m_manual_peers_count;
486
484
if (DetailsRequested ()) {
487
485
// Push data for this peer to the peers vector.
@@ -553,8 +551,11 @@ class NetinfoRequestHandler : public BaseRequestHandler
553
551
for (uint8_t i = 0 ; i < 3 ; ++i) {
554
552
result += strprintf (" \n %-5s %5i %5i %5i" , rows.at (i), m_counts.at (i).at (0 ), m_counts.at (i).at (1 ), m_counts.at (i).at (2 )); // ipv4/ipv6/onion peers counts
555
553
if (m_is_i2p_on) result += strprintf (" %5i" , m_counts.at (i).at (3 )); // i2p peers count
556
- result += strprintf (" %5i %5i" , m_counts.at (i).at (m_networks_size), m_counts.at (i).at (m_networks_size + 1 ));
557
- if (i == 1 && m_manual_peers_count) result += strprintf (" %5i" , m_manual_peers_count);
554
+ result += strprintf (" %5i" , m_counts.at (i).at (m_networks_size)); // total peers count
555
+ if (i == 1 ) { // the outbound row has two extra columns for block relay and manual peer counts
556
+ result += strprintf (" %5i" , m_block_relay_peers_count);
557
+ if (m_manual_peers_count) result += strprintf (" %5i" , m_manual_peers_count);
558
+ }
558
559
}
559
560
560
561
// Report local addresses, ports, and scores.
0 commit comments