diff options
Diffstat (limited to 'src/addrman.h')
-rw-r--r-- | src/addrman.h | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/addrman.h b/src/addrman.h index 8116d0b763..b72dda49d1 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -17,11 +17,15 @@ #include <stdint.h> #include <vector> -/** - * Extended statistics about a CAddress +/** + * Extended statistics about a CAddress */ 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; @@ -104,14 +105,14 @@ public: /** Stochastic address manager * * Design goals: - * * Keep the address tables in-memory, and asynchronously dump the entire to able in peers.dat. + * * Keep the address tables in-memory, and asynchronously dump the entire table to peers.dat. * * Make sure no (localized) attacker can fill the entire table with his nodes/addresses. * * To that end: * * Addresses are organized into buckets. * * Address that have not yet been tried go into 1024 "new" buckets. * * Based on the address range (/16 for IPv4) of source of the information, 64 buckets are selected at random - * * The actual bucket is chosen from one of these, based on the range the address itself is located. + * * The actual bucket is chosen from one of these, based on the range in which the address itself is located. * * One single address can occur in up to 8 different buckets, to increase selection chances for addresses that * are seen frequently. The chance for increasing this multiplicity decreases exponentially. * * When adding a new address to a full bucket, a randomly chosen entry (with a bias favoring less recently seen @@ -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(); |