PIVX Core  5.6.99
P2P Digital Currency
Public Member Functions | Private Attributes | List of all members
CAddrManTest Class Reference
Inheritance diagram for CAddrManTest:
[legend]
Collaboration diagram for CAddrManTest:
[legend]

Public Member Functions

 CAddrManTest (bool makeDeterministic=true, std::vector< bool > asmap=std::vector< bool >())
 
void MakeDeterministic ()
 Ensure that bucket placement is always the same for testing purposes. More...
 
CAddrInfoFind (const CNetAddr &addr, int *pnId=nullptr)
 
CAddrInfoCreate (const CAddress &addr, const CNetAddr &addrSource, int *pnId=nullptr)
 
void Delete (int nId)
 
std::pair< int, int > GetBucketAndEntry (const CAddress &addr)
 
void SimConnFail (CService &addr)
 
void Clear ()
 
- Public Member Functions inherited from CAddrMan
template<typename Stream >
void Serialize (Stream &s_) const
 Serialized format. More...
 
template<typename Stream >
void Unserialize (Stream &s_)
 
void Clear ()
 
 CAddrMan ()
 
 ~CAddrMan ()
 
size_t size () const
 Return the number of (unique) addresses in all tables. More...
 
void Check ()
 Consistency check. More...
 
bool Add (const CAddress &addr, const CNetAddr &source, int64_t nTimePenalty=0)
 Add a single address. More...
 
bool Add (const std::vector< CAddress > &vAddr, const CNetAddr &source, int64_t nTimePenalty=0)
 Add multiple addresses. More...
 
void Good (const CService &addr, bool test_before_evict=true, int64_t nTime=GetAdjustedTime())
 Mark an entry as accessible. More...
 
void Attempt (const CService &addr, bool fCountFailure, int64_t nTime=GetAdjustedTime())
 Mark an entry as connection attempted to. More...
 
void ResolveCollisions ()
 See if any to-be-evicted tried table entries have been tested and if so resolve the collisions. More...
 
CAddrInfo SelectTriedCollision ()
 Randomly select an address in tried that another address is attempting to evict. More...
 
CAddrInfo Select (bool newOnly=false)
 Choose an address to connect to. More...
 
std::vector< CAddressGetAddr (size_t max_addresses, size_t max_pct, Optional< Network > network)
 Return all or many randomly selected addresses, optionally by network. More...
 
void Connected (const CService &addr, int64_t nTime=GetAdjustedTime())
 Mark an entry as currently-connected-to. More...
 
void SetServices (const CService &addr, ServiceFlags nServices)
 

Private Attributes

bool deterministic
 

Additional Inherited Members

- Static Public Member Functions inherited from CAddrMan
static std::vector< bool > DecodeAsmap (fs::path path)
 
- Public Attributes inherited from CAddrMan
std::vector< bool > m_asmap
 
- Protected Member Functions inherited from CAddrMan
CAddrInfoFind (const CNetAddr &addr, int *pnId=nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs)
 Find an entry. More...
 
CAddrInfoCreate (const CAddress &addr, const CNetAddr &addrSource, int *pnId=nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs)
 find an entry, creating it if necessary. More...
 
void SwapRandom (unsigned int nRandomPos1, unsigned int nRandomPos2) EXCLUSIVE_LOCKS_REQUIRED(cs)
 Swap two elements in vRandom. More...
 
void MakeTried (CAddrInfo &info, int nId) EXCLUSIVE_LOCKS_REQUIRED(cs)
 Move an entry from the "new" table(s) to the "tried" table. More...
 
void Delete (int nId) EXCLUSIVE_LOCKS_REQUIRED(cs)
 Delete an entry. It must not be in tried, and have refcount 0. More...
 
void ClearNew (int nUBucket, int nUBucketPos) EXCLUSIVE_LOCKS_REQUIRED(cs)
 Clear a position in a "new" table. This is the only place where entries are actually deleted. More...
 
void Good_ (const CService &addr, bool test_before_evict, int64_t time) EXCLUSIVE_LOCKS_REQUIRED(cs)
 Mark an entry "good", possibly moving it from "new" to "tried". More...
 
bool Add_ (const CAddress &addr, const CNetAddr &source, int64_t nTimePenalty) EXCLUSIVE_LOCKS_REQUIRED(cs)
 Add an entry to the "new" table. More...
 
void Attempt_ (const CService &addr, bool fCountFailure, int64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(cs)
 Mark an entry as attempted to connect. More...
 
CAddrInfo Select_ (bool newOnly) EXCLUSIVE_LOCKS_REQUIRED(cs)
 Select an address to connect to, if newOnly is set to true, only the new table is selected from. More...
 
void ResolveCollisions_ () EXCLUSIVE_LOCKS_REQUIRED(cs)
 See if any to-be-evicted tried table entries have been tested and if so resolve the collisions. More...
 
CAddrInfo SelectTriedCollision_ () EXCLUSIVE_LOCKS_REQUIRED(cs)
 Return a random to-be-evicted tried table address. More...
 
void GetAddr_ (std::vector< CAddress > &vAddr, size_t max_addresses, size_t max_pct, Optional< Network > network) EXCLUSIVE_LOCKS_REQUIRED(cs)
 Return all or many randomly selected addresses, optionally by network. More...
 
void Connected_ (const CService &addr, int64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(cs)
 Mark an entry as currently-connected-to. More...
 
void SetServices_ (const CService &addr, ServiceFlags nServices) EXCLUSIVE_LOCKS_REQUIRED(cs)
 Update an entry's service bits. More...
 
- Protected Attributes inherited from CAddrMan
RecursiveMutex cs
 critical section to protect the inner data structures More...
 
uint256 nKey
 secret key to randomize bucket select with More...
 
FastRandomContext insecure_rand
 Source of random numbers for randomization in inner loops. More...
 

Detailed Description

Definition at line 21 of file addrman_tests.cpp.

Constructor & Destructor Documentation

◆ CAddrManTest()

CAddrManTest::CAddrManTest ( bool  makeDeterministic = true,
std::vector< bool >  asmap = std::vector<bool>() 
)
inlineexplicit

Definition at line 26 of file addrman_tests.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ Clear()

void CAddrManTest::Clear ( )
inline

Definition at line 89 of file addrman_tests.cpp.

Here is the call graph for this function:

◆ Create()

CAddrInfo* CAddrManTest::Create ( const CAddress addr,
const CNetAddr addrSource,
int *  pnId = nullptr 
)
inline

Definition at line 50 of file addrman_tests.cpp.

Here is the call graph for this function:

◆ Delete()

void CAddrManTest::Delete ( int  nId)
inline

Definition at line 56 of file addrman_tests.cpp.

Here is the call graph for this function:

◆ Find()

CAddrInfo* CAddrManTest::Find ( const CNetAddr addr,
int *  pnId = nullptr 
)
inline

Definition at line 44 of file addrman_tests.cpp.

Here is the call graph for this function:

◆ GetBucketAndEntry()

std::pair<int, int> CAddrManTest::GetBucketAndEntry ( const CAddress addr)
inline

Definition at line 63 of file addrman_tests.cpp.

◆ MakeDeterministic()

void CAddrManTest::MakeDeterministic ( )
inline

Ensure that bucket placement is always the same for testing purposes.

Definition at line 38 of file addrman_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SimConnFail()

void CAddrManTest::SimConnFail ( CService addr)
inline

Definition at line 78 of file addrman_tests.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ deterministic

bool CAddrManTest::deterministic
private

Definition at line 24 of file addrman_tests.cpp.


The documentation for this class was generated from the following file: