diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-04-24 15:51:54 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-04-24 16:11:23 +0200 |
commit | b9311fb6312075744418942e143325ec1f66dd5c (patch) | |
tree | 62d9f0be6b1be0206d01d96558351557075a6c96 | |
parent | 585b5dba745a25caf1cc20fdb751ff7cb3762bf0 (diff) | |
parent | 1d5b47a9033738743e5323409777b1415a0d0af7 (diff) |
Merge pull request #6028
1d5b47a nLastTry is only used for addrman entries (Pieter Wuille)
-rw-r--r-- | src/addrman.cpp | 4 | ||||
-rw-r--r-- | src/addrman.h | 13 | ||||
-rw-r--r-- | src/net.cpp | 2 | ||||
-rw-r--r-- | src/protocol.cpp | 1 | ||||
-rw-r--r-- | src/protocol.h | 3 |
5 files changed, 10 insertions, 13 deletions
diff --git a/src/addrman.cpp b/src/addrman.cpp index 094c913e9c..c41ee3f9fc 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -331,10 +331,10 @@ void CAddrMan::Attempt_(const CService& addr, int64_t nTime) info.nAttempts++; } -CAddress CAddrMan::Select_() +CAddrInfo CAddrMan::Select_() { if (size() == 0) - return CAddress(); + return CAddrInfo(); // Use a 50% chance for choosing between tried and new table entries. if (nTried > 0 && (nNew == 0 || GetRandInt(2) == 0)) { diff --git a/src/addrman.h b/src/addrman.h index 8116d0b763..5badd4ef95 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -22,6 +22,10 @@ */ class CAddrInfo : public CAddress { +public: + //! last try whatsoever by us (memory only) + int64_t nLastTry; + private: //! where knowledge about this address first came from CNetAddr source; @@ -29,9 +33,6 @@ private: //! last successful connection by us int64_t nLastSuccess; - //! last try whatsoever by us: - // int64_t CAddress::nLastTry - //! connection attempts since last successful attempt int nAttempts; @@ -231,7 +232,7 @@ protected: //! Select an address to connect to. //! nUnkBias determines how much to favor new addresses over tried ones (min=0, max=100) - CAddress Select_(); + CAddrInfo Select_(); #ifdef DEBUG_ADDRMAN //! Perform consistency check. Returns an error code or zero. @@ -533,9 +534,9 @@ public: * Choose an address to connect to. * nUnkBias determines how much "new" entries are favored over "tried" ones (0-100). */ - CAddress Select() + CAddrInfo Select() { - CAddress addrRet; + CAddrInfo addrRet; { LOCK(cs); Check(); diff --git a/src/net.cpp b/src/net.cpp index 48e6367f20..e5f67262ce 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -1221,7 +1221,7 @@ void ThreadOpenConnections() int nTries = 0; while (true) { - CAddress addr = addrman.Select(); + CAddrInfo addr = addrman.Select(); // if we selected an invalid address, restart if (!addr.IsValid() || setConnected.count(addr.GetGroup()) || IsLocal(addr)) diff --git a/src/protocol.cpp b/src/protocol.cpp index 568580a595..dd855aa33a 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -89,7 +89,6 @@ void CAddress::Init() { nServices = NODE_NETWORK; nTime = 100000000; - nLastTry = 0; } CInv::CInv() diff --git a/src/protocol.h b/src/protocol.h index fd23eae1fc..b5e65032a2 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -116,9 +116,6 @@ public: // disk and network only unsigned int nTime; - - // memory only - int64_t nLastTry; }; /** inv message data */ |