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
343
343
if (gArgs .GetChainName () == CBaseChainParams::REGTEST) return " regtest" ;
344
344
return " " ;
345
345
}
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
+ }
346
352
const int64_t m_time_now{GetSystemTimeInSeconds ()};
347
353
348
354
public:
@@ -428,8 +434,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
428
434
peer.is_outbound ? " out" : " in" ,
429
435
peer.is_block_relay ? " block" : " full" ,
430
436
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 ),
433
439
peer.last_send == 0 ? " " : ToString (m_time_now - peer.last_send ),
434
440
peer.last_recv == 0 ? " " : ToString (m_time_now - peer.last_recv ),
435
441
peer.last_trxn == 0 ? " " : ToString ((m_time_now - peer.last_trxn ) / 60 ),
You can’t perform that action at this time.
0 commit comments