RPC: getaddrmaninfo returns GetChance result for each item.
authorBalthazar <balthazar@yandex.ru>
Thu, 22 Jan 2015 12:45:03 +0000 (07:45 -0500)
committerBalthazar <balthazar@yandex.ru>
Thu, 22 Jan 2015 12:45:03 +0000 (07:45 -0500)
src/addrman.cpp
src/addrman.h
src/rpcnet.cpp

index cd80d3b..54f9a61 100644 (file)
@@ -507,7 +507,7 @@ void CAddrMan::GetAddr_(std::vector<CAddress> &vAddr)
     }
 }
 
-void CAddrMan::GetOnlineAddr_(std::vector<CAddress> &vAddr)
+void CAddrMan::GetOnlineAddr_(std::vector<CAddrInfo> &vAddr)
 {
     for (std::map<int, CAddrInfo>::const_iterator it = mapInfo.begin(); it != mapInfo.end(); it++)
     {
index ed35059..9aa167b 100644 (file)
@@ -239,7 +239,7 @@ protected:
 
     // Select several addresses at once.
     void GetAddr_(std::vector<CAddress> &vAddr);
-    void GetOnlineAddr_(std::vector<CAddress> &vAddr);
+    void GetOnlineAddr_(std::vector<CAddrInfo> &vAddr);
 
     // Mark an entry as currently-connected-to.
     void Connected_(const CService &addr, int64_t nTime);
@@ -666,10 +666,10 @@ public:
         return vAddr;
     }
 
-    std::vector<CAddress> GetOnlineAddr()
+    std::vector<CAddrInfo> GetOnlineAddr()
     {
         Check();
-        std::vector<CAddress> vAddr;
+        std::vector<CAddrInfo> vAddr;
         {
             LOCK(cs);
             GetOnlineAddr_(vAddr);
index f476ce0..9445b44 100644 (file)
@@ -44,11 +44,11 @@ Value getaddrmaninfo(const Array& params, bool fHelp)
             "Returns a dump of addrman data.");
 
     // Return a full list of "online" address items
-    vector<CAddress> vAddr = addrman.GetOnlineAddr();
+    vector<CAddrInfo> vAddr = addrman.GetOnlineAddr();
 
     Array ret;
 
-    BOOST_FOREACH(const CAddress &addr, vAddr) {
+    BOOST_FOREACH(const CAddrInfo &addr, vAddr) {
         if (!addr.IsRoutable() || addr.IsLocal())
             continue;
 
@@ -72,6 +72,7 @@ Value getaddrmaninfo(const Array& params, bool fHelp)
                 strNetType = "ipv6";
 
         }
+        addrManItem.push_back(Pair("chance", addr.GetChance(GetTime())));
         addrManItem.push_back(Pair("type", strNetType));
         addrManItem.push_back(Pair("time", (int64_t)addr.nTime));