| 24 | #include <univalue.h> |
| 25 | |
| 26 | static UniValue getconnectioncount(const JSONRPCRequest& request) |
| 27 | { |
| 28 | if (request.fHelp || request.params.size() != 0) |
| 29 | throw std::runtime_error( |
| 30 | "getconnectioncount\n" |
| 31 | "\nReturns the number of connections to other nodes.\n" |
| 32 | "\nResult:\n" |
| 33 | "n (numeric) The connection count\n" |
| 34 | "\nExamples:\n" |
| 35 | + HelpExampleCli("getconnectioncount", "") |
| 36 | + HelpExampleRpc("getconnectioncount", "") |
| 37 | ); |
| 38 | |
| 39 | if(!g_connman) |
| 40 | throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled"); |
| 41 | |
| 42 | return (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL); |
| 43 | } |
| 44 | |
| 45 | static UniValue ping(const JSONRPCRequest& request) |
| 46 | { |
nothing calls this directly
no test coverage detected