aboutsummaryrefslogtreecommitdiff
path: root/src/addrman.h
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-01-05 12:02:12 +0100
committerMarcoFalke <falke.marco@gmail.com>2019-01-05 16:16:37 +0100
commitfa2510d5c1cdf9c2cd5cc9887302ced4378c7202 (patch)
tree616492efb0b268d8e37ba57bda813aaacc66c975 /src/addrman.h
parentf7e182a973ed66b4c11dc6239e57016655503b4c (diff)
downloadbitcoin-fa2510d5c1cdf9c2cd5cc9887302ced4378c7202.tar.xz
Use C++11 default member initializers
Diffstat (limited to 'src/addrman.h')
-rw-r--r--src/addrman.h30
1 files changed, 7 insertions, 23 deletions
diff --git a/src/addrman.h b/src/addrman.h
index af5a1d3b23..003bd059f8 100644
--- a/src/addrman.h
+++ b/src/addrman.h
@@ -23,33 +23,31 @@
*/
class CAddrInfo : public CAddress
{
-
-
public:
//! last try whatsoever by us (memory only)
- int64_t nLastTry;
+ int64_t nLastTry{0};
//! last counted attempt (memory only)
- int64_t nLastCountAttempt;
+ int64_t nLastCountAttempt{0};
private:
//! where knowledge about this address first came from
CNetAddr source;
//! last successful connection by us
- int64_t nLastSuccess;
+ int64_t nLastSuccess{0};
//! connection attempts since last successful attempt
- int nAttempts;
+ int nAttempts{0};
//! reference count in new sets (memory only)
- int nRefCount;
+ int nRefCount{0};
//! in tried set? (memory only)
- bool fInTried;
+ bool fInTried{false};
//! position in vRandom
- int nRandomPos;
+ int nRandomPos{-1};
friend class CAddrMan;
@@ -65,25 +63,12 @@ public:
READWRITE(nAttempts);
}
- void Init()
- {
- nLastSuccess = 0;
- nLastTry = 0;
- nLastCountAttempt = 0;
- nAttempts = 0;
- nRefCount = 0;
- fInTried = false;
- nRandomPos = -1;
- }
-
CAddrInfo(const CAddress &addrIn, const CNetAddr &addrSource) : CAddress(addrIn), source(addrSource)
{
- Init();
}
CAddrInfo() : CAddress(), source()
{
- Init();
}
//! Calculate in which "tried" bucket this entry belongs
@@ -106,7 +91,6 @@ public:
//! Calculate the relative chance this entry should be given when selecting nodes to connect to
double GetChance(int64_t nNow = GetAdjustedTime()) const;
-
};
/** Stochastic address manager