diff options
author | John Newbery <john@johnnewbery.com> | 2020-06-21 18:56:19 -0400 |
---|---|---|
committer | John Newbery <john@johnnewbery.com> | 2021-02-15 16:15:51 +0000 |
commit | 45dcf2266125c65d7f546bdb211a278bd090a284 (patch) | |
tree | 384028a852c66190b8f8b1cd5773b90e15880049 /src/rpc/net.cpp | |
parent | dd2646d12c172cb8899669af717c590483a17404 (diff) | |
download | bitcoin-45dcf2266125c65d7f546bdb211a278bd090a284.tar.xz |
[net processing] Move ping data fields to net processing
Diffstat (limited to 'src/rpc/net.cpp')
-rw-r--r-- | src/rpc/net.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index e83f66dd12..0224ee697a 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -77,13 +77,12 @@ static RPCHelpMan ping() [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue { NodeContext& node = EnsureNodeContext(request.context); - if(!node.connman) + if (!node.peerman) { throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); + } // Request that each node send a ping during next message processing pass - node.connman->ForEachNode([](CNode* pnode) { - pnode->fPingQueued = true; - }); + node.peerman->SendPings(); return NullUniValue; }, }; @@ -209,8 +208,8 @@ static RPCHelpMan getpeerinfo() if (stats.m_min_ping_usec < std::numeric_limits<int64_t>::max()) { obj.pushKV("minping", ((double)stats.m_min_ping_usec) / 1e6); } - if (stats.m_ping_wait_usec > 0) { - obj.pushKV("pingwait", ((double)stats.m_ping_wait_usec) / 1e6); + if (fStateStats && statestats.m_ping_wait_usec > 0) { + obj.pushKV("pingwait", ((double)statestats.m_ping_wait_usec) / 1e6); } obj.pushKV("version", stats.nVersion); // Use the sanitized form of subver here, to avoid tricksy remote peers from |