File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -343,6 +343,12 @@ class NetinfoRequestHandler : public BaseRequestHandler
343343 if (gArgs .GetChainName () == CBaseChainParams::REGTEST) return " regtest" ;
344344 return " " ;
345345 }
346+ std::string PingTimeToString (double seconds) const
347+ {
348+ if (seconds < 0 ) return " " ;
349+ const double milliseconds{round (1000 * seconds)};
350+ return milliseconds > 999999 ? " -" : ToString (milliseconds);
351+ }
346352 const int64_t m_time_now{GetSystemTimeInSeconds ()};
347353
348354public:
@@ -428,8 +434,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
428434 peer.is_outbound ? " out" : " in" ,
429435 peer.is_block_relay ? " block" : " full" ,
430436 peer.network ,
431- peer. min_ping == - 1 ? " " : ToString ( round ( 1000 * peer.min_ping ) ),
432- peer. ping == - 1 ? " " : ToString ( round ( 1000 * peer.ping ) ),
437+ PingTimeToString ( peer.min_ping ),
438+ PingTimeToString ( peer.ping ),
433439 peer.last_send == 0 ? " " : ToString (m_time_now - peer.last_send ),
434440 peer.last_recv == 0 ? " " : ToString (m_time_now - peer.last_recv ),
435441 peer.last_trxn == 0 ? " " : ToString ((m_time_now - peer.last_trxn ) / 60 ),
You can’t perform that action at this time.
0 commit comments