From 6708cec23932f0ce0a8d36f06b53dd14ecb129cc Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Tue, 31 Dec 2013 09:46:19 -0200 Subject: [PATCH] report dht_global_nodes in getinfo --- src/rpcwallet.cpp | 4 +++- src/twister.cpp | 4 +++- src/twister.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rpcwallet.cpp b/src/rpcwallet.cpp index b562ede2..12de4bd9 100644 --- a/src/rpcwallet.cpp +++ b/src/rpcwallet.cpp @@ -83,7 +83,9 @@ Value getinfo(const Array& params, bool fHelp) obj.push_back(Pair("addrman_total", (int)addrman.size())); obj.push_back(Pair("addrman_get", (int)addrman.GetAddr().size())); } - obj.push_back(Pair("dht_nodes", getDhtNodes())); + boost::int64_t dht_global_nodes; + obj.push_back(Pair("dht_nodes", getDhtNodes(&dht_global_nodes))); + obj.push_back(Pair("dht_global_nodes", dht_global_nodes)); obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string()))); { LOCK(cs_main); diff --git a/src/twister.cpp b/src/twister.cpp index 4496b885..08283a56 100644 --- a/src/twister.cpp +++ b/src/twister.cpp @@ -350,11 +350,13 @@ void lockAndSaveUserData() } } -int getDhtNodes() +int getDhtNodes(boost::int64_t *dht_global_nodes) { if( !ses ) return 0; session_status ss = ses->status(); + if( dht_global_nodes ) + *dht_global_nodes = ss.dht_global_nodes; return ss.dht_nodes; } diff --git a/src/twister.h b/src/twister.h index 91610cc9..00b602b9 100644 --- a/src/twister.h +++ b/src/twister.h @@ -37,6 +37,6 @@ void receivedSpamMessage(std::string const &message, std::string const &user); int getBestHeight(); bool shouldDhtResourceExpire(std::string resource, bool multi, int height); -int getDhtNodes(); +int getDhtNodes(boost::int64_t *dht_global_nodes = NULL); #endif // TWISTER_H