From a6eb4ba38bdb2f12089faf7469b54ea2a5146516 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 3 Sep 2015 13:06:13 -0700 Subject: [PATCH] Report minimum ping time in getpeerinfo --- src/net.cpp | 1 + src/net.h | 1 + src/rpcnet.cpp | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/net.cpp b/src/net.cpp index 4909d5fd40..526e2049a8 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -628,6 +628,7 @@ void CNode::copyStats(CNodeStats &stats) // Raw ping time is in microseconds, but show it to user as whole seconds (Bitcoin users should be well used to small numbers with many decimal places by now :) stats.dPingTime = (((double)nPingUsecTime) / 1e6); + stats.dPingMin = (((double)nMinPingUsecTime) / 1e6); stats.dPingWait = (((double)nPingUsecWait) / 1e6); // Leave string empty if addrLocal invalid (not filled in yet) diff --git a/src/net.h b/src/net.h index f370bf1ff4..6842ee5edc 100644 --- a/src/net.h +++ b/src/net.h @@ -189,6 +189,7 @@ public: bool fWhitelisted; double dPingTime; double dPingWait; + double dPingMin; std::string addrLocal; }; diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 56ec59171d..30d0ed6270 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -96,6 +96,7 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp) " \"conntime\": ttt, (numeric) The connection time in seconds since epoch (Jan 1 1970 GMT)\n" " \"timeoffset\": ttt, (numeric) The time offset in seconds\n" " \"pingtime\": n, (numeric) ping time\n" + " \"minping\": n, (numeric) minimum observed ping time\n" " \"pingwait\": n, (numeric) ping wait\n" " \"version\": v, (numeric) The peer version, such as 7001\n" " \"subver\": \"/Satoshi:0.8.5/\", (string) The string version\n" @@ -139,6 +140,7 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp) obj.push_back(Pair("conntime", stats.nTimeConnected)); obj.push_back(Pair("timeoffset", stats.nTimeOffset)); obj.push_back(Pair("pingtime", stats.dPingTime)); + obj.push_back(Pair("minping", stats.dPingMin)); if (stats.dPingWait > 0.0) obj.push_back(Pair("pingwait", stats.dPingWait)); obj.push_back(Pair("version", stats.nVersion));