mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 08:17:37 +00:00
RPC: get_info add rpc_connections_count
This commit is contained in:
parent
a2c2f4e4b0
commit
fa51408272
4 changed files with 16 additions and 1 deletions
|
@ -213,6 +213,12 @@ namespace net_utils
|
|||
|
||||
int get_binded_port(){return m_port;}
|
||||
|
||||
long get_connections_count() const
|
||||
{
|
||||
auto connections_count = (m_sock_count > 0) ? (m_sock_count - 1) : 0; // Socket count minus listening socket
|
||||
return connections_count;
|
||||
}
|
||||
|
||||
boost::asio::io_service& get_io_service(){return io_service_;}
|
||||
|
||||
struct idle_callback_conext_base
|
||||
|
|
|
@ -117,6 +117,11 @@ namespace epee
|
|||
return m_net_server.get_binded_port();
|
||||
}
|
||||
|
||||
long get_connections_count() const
|
||||
{
|
||||
return m_net_server.get_connections_count();
|
||||
}
|
||||
|
||||
protected:
|
||||
net_utils::boosted_tcp_server<net_utils::http::http_custom_handler<t_connection_context> > m_net_server;
|
||||
};
|
||||
|
|
|
@ -150,6 +150,7 @@ namespace cryptonote
|
|||
uint64_t total_conn = m_p2p.get_connections_count();
|
||||
res.outgoing_connections_count = m_p2p.get_outgoing_connections_count();
|
||||
res.incoming_connections_count = total_conn - res.outgoing_connections_count;
|
||||
res.rpc_connections_count = get_connections_count();
|
||||
res.white_peerlist_size = m_p2p.get_peerlist_manager().get_white_peers_count();
|
||||
res.grey_peerlist_size = m_p2p.get_peerlist_manager().get_gray_peers_count();
|
||||
res.testnet = m_testnet;
|
||||
|
@ -1328,6 +1329,7 @@ namespace cryptonote
|
|||
uint64_t total_conn = m_p2p.get_connections_count();
|
||||
res.outgoing_connections_count = m_p2p.get_outgoing_connections_count();
|
||||
res.incoming_connections_count = total_conn - res.outgoing_connections_count;
|
||||
res.rpc_connections_count = get_connections_count();
|
||||
res.white_peerlist_size = m_p2p.get_peerlist_manager().get_white_peers_count();
|
||||
res.grey_peerlist_size = m_p2p.get_peerlist_manager().get_gray_peers_count();
|
||||
res.testnet = m_testnet;
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace cryptonote
|
|||
// advance which version they will stop working with
|
||||
// Don't go over 32767 for any of these
|
||||
#define CORE_RPC_VERSION_MAJOR 1
|
||||
#define CORE_RPC_VERSION_MINOR 15
|
||||
#define CORE_RPC_VERSION_MINOR 16
|
||||
#define MAKE_CORE_RPC_VERSION(major,minor) (((major)<<16)|(minor))
|
||||
#define CORE_RPC_VERSION MAKE_CORE_RPC_VERSION(CORE_RPC_VERSION_MAJOR, CORE_RPC_VERSION_MINOR)
|
||||
|
||||
|
@ -917,6 +917,7 @@ namespace cryptonote
|
|||
uint64_t alt_blocks_count;
|
||||
uint64_t outgoing_connections_count;
|
||||
uint64_t incoming_connections_count;
|
||||
uint64_t rpc_connections_count;
|
||||
uint64_t white_peerlist_size;
|
||||
uint64_t grey_peerlist_size;
|
||||
bool testnet;
|
||||
|
@ -936,6 +937,7 @@ namespace cryptonote
|
|||
KV_SERIALIZE(alt_blocks_count)
|
||||
KV_SERIALIZE(outgoing_connections_count)
|
||||
KV_SERIALIZE(incoming_connections_count)
|
||||
KV_SERIALIZE(rpc_connections_count)
|
||||
KV_SERIALIZE(white_peerlist_size)
|
||||
KV_SERIALIZE(grey_peerlist_size)
|
||||
KV_SERIALIZE(testnet)
|
||||
|
|
Loading…
Reference in a new issue