Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

Extended statistics about a CAddress. More...

#include <addrman.h>

+ Inheritance diagram for CAddrInfo:
+ Collaboration diagram for CAddrInfo:

Public Member Functions

template<typename Stream , typename Operation >
void SerializationOp (Stream &s, Operation ser_action)
 
void Init ()
 
 CAddrInfo (const CAddress &addrIn, const CNetAddr &addrSource)
 
 CAddrInfo ()
 
int GetTriedBucket (const uint256 &nKey) const
 Calculate in which "tried" bucket this entry belongs. More...
 
int GetNewBucket (const uint256 &nKey, const CNetAddr &src) const
 Calculate in which "new" bucket this entry belongs, given a certain source. More...
 
int GetNewBucket (const uint256 &nKey) const
 Calculate in which "new" bucket this entry belongs, using its default source. More...
 
int GetBucketPosition (const uint256 &nKey, bool fNew, int nBucket) const
 Calculate in which position of a bucket to store this entry. More...
 
bool IsTerrible (int64_t nNow=GetAdjustedTime()) const
 Determine whether the statistics about this entry are bad enough so that it can just be deleted. More...
 
double GetChance (int64_t nNow=GetAdjustedTime()) const
 Calculate the relative chance this entry should be given when selecting nodes to connect to. More...
 
- Public Member Functions inherited from CAddress
 CAddress ()
 
 CAddress (CService ipIn, ServiceFlags nServicesIn)
 
void Init ()
 
template<typename Stream , typename Operation >
void SerializationOp (Stream &s, Operation ser_action)
 
- Public Member Functions inherited from CService
 CService ()
 
 CService (const CNetAddr &ip, unsigned short port)
 
 CService (const struct in_addr &ipv4Addr, unsigned short port)
 
 CService (const struct sockaddr_in &addr)
 
void SetPort (unsigned short portIn)
 
unsigned short GetPort () const
 
bool GetSockAddr (struct sockaddr *paddr, socklen_t *addrlen) const
 
bool SetSockAddr (const struct sockaddr *paddr)
 
std::vector< unsigned char > GetKey () const
 
std::string ToString (bool fUseGetnameinfo=true) const
 
std::string ToStringPort () const
 
std::string ToStringIPPort (bool fUseGetnameinfo=true) const
 
 CService (const struct in6_addr &ipv6Addr, unsigned short port)
 
 CService (const struct sockaddr_in6 &addr)
 
template<typename Stream , typename Operation >
void SerializationOp (Stream &s, Operation ser_action)
 
- Public Member Functions inherited from CNetAddr
 CNetAddr ()
 
 CNetAddr (const struct in_addr &ipv4Addr)
 
void SetIP (const CNetAddr &ip)
 
bool SetInternal (const std::string &name)
 Transform an arbitrary string into a non-routable ipv6 address. More...
 
bool SetSpecial (const std::string &strName)
 
bool IsIPv4 () const
 
bool IsIPv6 () const
 
bool IsRFC1918 () const
 
bool IsRFC2544 () const
 
bool IsRFC6598 () const
 
bool IsRFC5737 () const
 
bool IsRFC3849 () const
 
bool IsRFC3927 () const
 
bool IsRFC3964 () const
 
bool IsRFC4193 () const
 
bool IsRFC4380 () const
 
bool IsRFC4843 () const
 
bool IsRFC4862 () const
 
bool IsRFC6052 () const
 
bool IsRFC6145 () const
 
bool IsTor () const
 
bool IsLocal () const
 
bool IsRoutable () const
 
bool IsInternal () const
 
bool IsValid () const
 
enum Network GetNetwork () const
 
std::string ToString () const
 
std::string ToStringIP (bool fUseGetnameinfo=true) const
 
unsigned int GetByte (int n) const
 
uint64_t GetHash () const
 
bool GetInAddr (struct in_addr *pipv4Addr) const
 
std::vector< unsigned char > GetGroup () const
 
int GetReachabilityFrom (const CNetAddr *paddrPartner=nullptr) const
 Calculates a metric for how reachable (*this) is from a given partner. More...
 
 CNetAddr (const struct in6_addr &pipv6Addr, const uint32_t scope=0)
 
bool GetIn6Addr (struct in6_addr *pipv6Addr) const
 
template<typename Stream , typename Operation >
void SerializationOp (Stream &s, Operation ser_action)
 

Public Attributes

int64_t nLastTry
 last try whatsoever by us (memory only) More...
 
int64_t nLastCountAttempt
 last counted attempt (memory only) More...
 
 ADD_SERIALIZE_METHODS
 
- Public Attributes inherited from CAddress
 ADD_SERIALIZE_METHODS
 
ServiceFlags nServices
 
unsigned int nTime
 
- Public Attributes inherited from CService
 ADD_SERIALIZE_METHODS
 
- Public Attributes inherited from CNetAddr
 ADD_SERIALIZE_METHODS
 

Private Attributes

CNetAddr source
 where knowledge about this address first came from More...
 
int64_t nLastSuccess
 last successful connection by us More...
 
int nAttempts
 connection attempts since last successful attempt More...
 
int nRefCount
 reference count in new sets (memory only) More...
 
bool fInTried
 in tried set? (memory only) More...
 
int nRandomPos
 position in vRandom More...
 

Friends

class CAddrMan
 

Additional Inherited Members

- Protected Attributes inherited from CService
unsigned short port
 
- Protected Attributes inherited from CNetAddr
unsigned char ip [16]
 
uint32_t scopeId
 

Detailed Description

Extended statistics about a CAddress.

Definition at line 24 of file addrman.h.

Constructor & Destructor Documentation

◆ CAddrInfo() [1/2]

CAddrInfo::CAddrInfo ( const CAddress addrIn,
const CNetAddr addrSource 
)
inline

Definition at line 79 of file addrman.h.

References Init().

◆ CAddrInfo() [2/2]

CAddrInfo::CAddrInfo ( )
inline

Definition at line 84 of file addrman.h.

References Init().

Member Function Documentation

◆ GetBucketPosition()

int CAddrInfo::GetBucketPosition ( const uint256 nKey,
bool  fNew,
int  nBucket 
) const

Calculate in which position of a bucket to store this entry.

Definition at line 27 of file addrman.cpp.

References ADDRMAN_BUCKET_SIZE, CNetAddr::GetHash(), CService::GetKey(), and SER_GETHASH.

Referenced by CAddrMan::Add_(), CAddrMan::Good_(), CAddrMan::MakeTried(), and CAddrMan::Unserialize().

◆ GetChance()

double CAddrInfo::GetChance ( int64_t  nNow = GetAdjustedTime()) const

Calculate the relative chance this entry should be given when selecting nodes to connect to.

Definition at line 53 of file addrman.cpp.

References nAttempts, and nLastTry.

◆ GetNewBucket() [1/2]

int CAddrInfo::GetNewBucket ( const uint256 nKey,
const CNetAddr src 
) const

Calculate in which "new" bucket this entry belongs, given a certain source.

Definition at line 19 of file addrman.cpp.

References ADDRMAN_NEW_BUCKET_COUNT, ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP, CNetAddr::GetGroup(), CNetAddr::GetHash(), and SER_GETHASH.

Referenced by CAddrMan::Add_(), and GetNewBucket().

◆ GetNewBucket() [2/2]

int CAddrInfo::GetNewBucket ( const uint256 nKey) const
inline

Calculate in which "new" bucket this entry belongs, using its default source.

Definition at line 96 of file addrman.h.

References GetNewBucket(), CAddrMan::nKey, and source.

◆ GetTriedBucket()

int CAddrInfo::GetTriedBucket ( const uint256 nKey) const

Calculate in which "tried" bucket this entry belongs.

Definition at line 12 of file addrman.cpp.

References ADDRMAN_TRIED_BUCKET_COUNT, ADDRMAN_TRIED_BUCKETS_PER_GROUP, CNetAddr::GetGroup(), CNetAddr::GetHash(), CService::GetKey(), and SER_GETHASH.

Referenced by CAddrMan::MakeTried(), and CAddrMan::Unserialize().

◆ Init()

void CAddrInfo::Init ( )
inline

Definition at line 68 of file addrman.h.

References fInTried, nAttempts, nLastCountAttempt, nLastSuccess, nLastTry, nRandomPos, and nRefCount.

Referenced by CAddrInfo().

◆ IsTerrible()

bool CAddrInfo::IsTerrible ( int64_t  nNow = GetAdjustedTime()) const

Determine whether the statistics about this entry are bad enough so that it can just be deleted.

Definition at line 33 of file addrman.cpp.

References ADDRMAN_HORIZON_DAYS, ADDRMAN_MAX_FAILURES, ADDRMAN_MIN_FAIL_DAYS, ADDRMAN_RETRIES, nAttempts, nLastSuccess, nLastTry, and CAddress::nTime.

Referenced by CAddrMan::Add_().

◆ SerializationOp()

template<typename Stream , typename Operation >
void CAddrInfo::SerializationOp ( Stream &  s,
Operation  ser_action 
)
inline

Definition at line 61 of file addrman.h.

References nAttempts, nLastSuccess, READWRITE, and source.

Friends And Related Function Documentation

◆ CAddrMan

friend class CAddrMan
friend

Definition at line 54 of file addrman.h.

Member Data Documentation

◆ ADD_SERIALIZE_METHODS

CAddrInfo::ADD_SERIALIZE_METHODS

Definition at line 58 of file addrman.h.

◆ fInTried

bool CAddrInfo::fInTried
private

in tried set? (memory only)

Definition at line 49 of file addrman.h.

Referenced by CAddrMan::Add_(), CAddrMan::Good_(), Init(), CAddrMan::MakeTried(), and CAddrMan::Serialize().

◆ nAttempts

int CAddrInfo::nAttempts
private

connection attempts since last successful attempt

Definition at line 43 of file addrman.h.

Referenced by CAddrMan::Attempt_(), GetChance(), CAddrMan::Good_(), Init(), IsTerrible(), and SerializationOp().

◆ nLastCountAttempt

int64_t CAddrInfo::nLastCountAttempt

last counted attempt (memory only)

Definition at line 33 of file addrman.h.

Referenced by CAddrMan::Attempt_(), and Init().

◆ nLastSuccess

int64_t CAddrInfo::nLastSuccess
private

last successful connection by us

Definition at line 40 of file addrman.h.

Referenced by CAddrMan::Good_(), Init(), IsTerrible(), and SerializationOp().

◆ nLastTry

int64_t CAddrInfo::nLastTry

last try whatsoever by us (memory only)

Definition at line 30 of file addrman.h.

Referenced by CAddrMan::Attempt_(), GetChance(), CAddrMan::Good_(), Init(), IsTerrible(), and CConnman::ThreadOpenConnections().

◆ nRandomPos

int CAddrInfo::nRandomPos
private

position in vRandom

Definition at line 52 of file addrman.h.

Referenced by Init().

◆ nRefCount

int CAddrInfo::nRefCount
private

reference count in new sets (memory only)

Definition at line 46 of file addrman.h.

Referenced by CAddrMan::Add_(), CAddrMan::ClearNew(), Init(), CAddrMan::MakeTried(), CAddrMan::Serialize(), and CAddrMan::Unserialize().

◆ source

CNetAddr CAddrInfo::source
private

where knowledge about this address first came from

Definition at line 37 of file addrman.h.

Referenced by GetNewBucket(), and SerializationOp().


The documentation for this class was generated from the following files:
Released under the MIT license