@@ -344,8 +344,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
344
344
if (!batch[ID_NETWORKINFO][" error" ].isNull ()) return batch[ID_NETWORKINFO];
345
345
346
346
// Count peer connection totals.
347
- int ipv4_i{0 }, ipv6_i{0 }, onion_i{0 }, block_relay_i{0 }; // inbound conn counters
348
- int ipv4_o{0 }, ipv6_o{0 }, onion_o{0 }, block_relay_o{0 }; // outbound conn counters
347
+ int ipv4_i{0 }, ipv6_i{0 }, onion_i{0 }, block_relay_i{0 }, total_i{ 0 } ; // inbound conn counters
348
+ int ipv4_o{0 }, ipv6_o{0 }, onion_o{0 }, block_relay_o{0 }, total_o{ 0 } ; // outbound conn counters
349
349
const UniValue& getpeerinfo{batch[ID_PEERINFO][" result" ]};
350
350
351
351
for (const UniValue& peer : getpeerinfo.getValues ()) {
@@ -379,6 +379,14 @@ class NetinfoRequestHandler : public BaseRequestHandler
379
379
const UniValue& networkinfo{batch[ID_NETWORKINFO][" result" ]};
380
380
std::string result{strprintf (" %s %s%s - %i%s\n\n " , PACKAGE_NAME, FormatFullVersion (), ChainToString (), networkinfo[" protocolversion" ].get_int (), networkinfo[" subversion" ].get_str ())};
381
381
382
+ // Report peer connection totals by type.
383
+ total_i = ipv4_i + ipv6_i + onion_i;
384
+ total_o = ipv4_o + ipv6_o + onion_o;
385
+ result += " ipv4 ipv6 onion total block-relay\n " ;
386
+ result += strprintf (" in %5i %5i %5i %5i %5i\n " , ipv4_i, ipv6_i, onion_i, total_i, block_relay_i);
387
+ result += strprintf (" out %5i %5i %5i %5i %5i\n " , ipv4_o, ipv6_o, onion_o, total_o, block_relay_o);
388
+ result += strprintf (" total %5i %5i %5i %5i %5i\n " , ipv4_i + ipv4_o, ipv6_i + ipv6_o, onion_i + onion_o, total_i + total_o, block_relay_i + block_relay_o);
389
+
382
390
return JSONRPCReplyObj (UniValue{result}, NullUniValue, 1 );
383
391
}
384
392
};
0 commit comments