Browse Source

report dht_global_nodes in getinfo

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
6708cec239
  1. 4
      src/rpcwallet.cpp
  2. 4
      src/twister.cpp
  3. 2
      src/twister.h

4
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_total", (int)addrman.size()));
obj.push_back(Pair("addrman_get", (int)addrman.GetAddr().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()))); obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string())));
{ {
LOCK(cs_main); LOCK(cs_main);

4
src/twister.cpp

@ -350,11 +350,13 @@ void lockAndSaveUserData()
} }
} }
int getDhtNodes() int getDhtNodes(boost::int64_t *dht_global_nodes)
{ {
if( !ses ) if( !ses )
return 0; return 0;
session_status ss = ses->status(); session_status ss = ses->status();
if( dht_global_nodes )
*dht_global_nodes = ss.dht_global_nodes;
return ss.dht_nodes; return ss.dht_nodes;
} }

2
src/twister.h

@ -37,6 +37,6 @@ void receivedSpamMessage(std::string const &message, std::string const &user);
int getBestHeight(); int getBestHeight();
bool shouldDhtResourceExpire(std::string resource, bool multi, int height); bool shouldDhtResourceExpire(std::string resource, bool multi, int height);
int getDhtNodes(); int getDhtNodes(boost::int64_t *dht_global_nodes = NULL);
#endif // TWISTER_H #endif // TWISTER_H

Loading…
Cancel
Save