![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#include "net.h"
#include "addrman.h"
#include "chainparams.h"
#include "clientversion.h"
#include "consensus/consensus.h"
#include "crypto/common.h"
#include "hash.h"
#include "primitives/transaction.h"
#include "netbase.h"
#include "scheduler.h"
#include "ui_interface.h"
#include "wallet/wallet.h"
#include "utilstrencodings.h"
#include "instantx.h"
#include "masternode-sync.h"
#include "masternodeman.h"
#include "privatesend.h"
#include <fcntl.h>
#include <math.h>
Go to the source code of this file.
Classes | |
struct | NodeEvictionCandidate |
class | CNetCleanup |
Macros | |
#define | DUMP_ADDRESSES_INTERVAL 900 |
#define | FEELER_SLEEP_WINDOW 1 |
#define | X(name) stats.name = name |
Functions | |
CNodeSignals & | GetNodeSignals () |
unsigned short | GetListenPort () |
bool | GetLocal (CService &addr, const CNetAddr *paddrPeer) |
static std::vector< CAddress > | convertSeed6 (const std::vector< SeedSpec6 > &vSeedsIn) |
Convert the pnSeeds6 array into usable address objects. More... | |
CAddress | GetLocalAddress (const CNetAddr *paddrPeer, ServiceFlags nLocalServices) |
int | GetnScore (const CService &addr) |
bool | IsPeerAddrLocalGood (CNode *pnode) |
void | AdvertiseLocal (CNode *pnode) |
bool | AddLocal (const CService &addr, int nScore) |
bool | AddLocal (const CNetAddr &addr, int nScore) |
bool | RemoveLocal (const CService &addr) |
void | SetLimited (enum Network net, bool fLimited) |
bool | IsLimited (enum Network net) |
bool | IsLimited (const CNetAddr &addr) |
bool | SeenLocal (const CService &addr) |
bool | IsLocal (const CService &addr) |
bool | IsReachable (enum Network net) |
bool | IsReachable (const CNetAddr &addr) |
static bool | ReverseCompareNodeMinPingTime (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
static bool | ReverseCompareNodeTimeConnected (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
static bool | CompareKeyedNetGroup (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
static bool | CompareNodeBlockTime (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
static bool | CompareNodeTXTime (const NodeEvictionCandidate &a, const NodeEvictionCandidate &b) |
void | MapPort (bool) |
void | Discover (boost::thread_group &threadGroup) |
int64_t | PoissonNextSend (int64_t nNow, int average_interval_seconds) |
Variables | |
static const std::string | NET_MESSAGE_COMMAND_OTHER = "*other*" |
bool | fDiscover = true |
bool | fListen = true |
bool | fRelayTxes = true |
CCriticalSection | cs_mapLocalHost |
std::map< CNetAddr, LocalServiceInfo > | mapLocalHost |
static bool | vfLimited [NET_MAX] = {} |
static CNode * | pnodeLocalHost = NULL |
std::string | strSubVersion |
std::map< CInv, CDataStream > | mapRelay |
std::deque< pair< int64_t, CInv > > | vRelayExpiration |
CCriticalSection | cs_mapRelay |
limitedmap< uint256, int64_t > | mapAlreadyAskedFor (MAX_INV_SZ) |
static CNodeSignals | g_signals |
class CNetCleanup | instance_of_cnetcleanup |
#define DUMP_ADDRESSES_INTERVAL 900 |
Definition at line 48 of file net.cpp.
Referenced by CConnman::Start().
#define FEELER_SLEEP_WINDOW 1 |
Definition at line 51 of file net.cpp.
Referenced by CConnman::ThreadOpenConnections().
#define X | ( | name | ) | stats.name = name |
Definition at line 634 of file net.cpp.
Referenced by CNode::copyStats(), and memusage::DynamicUsage().
bool AddLocal | ( | const CService & | addr, |
int | nScore | ||
) |
Definition at line 205 of file net.cpp.
Referenced by TorController::add_onion_cb(), AddLocal(), AppInit2(), CConnman::BindListenPort(), and Discover().
void AdvertiseLocal | ( | CNode * | pnode | ) |
Definition at line 183 of file net.cpp.
Referenced by SendMessages().
|
static |
Definition at line 894 of file net.cpp.
Referenced by CConnman::AttemptToEvictConnection().
|
static |
Definition at line 899 of file net.cpp.
Referenced by CConnman::AttemptToEvictConnection().
|
static |
Definition at line 907 of file net.cpp.
Referenced by CConnman::AttemptToEvictConnection().
Convert the pnSeeds6 array into usable address objects.
Definition at line 131 of file net.cpp.
Referenced by CConnman::ThreadOpenConnections().
void Discover | ( | boost::thread_group & | threadGroup | ) |
Definition at line 2062 of file net.cpp.
Referenced by AppInit2().
unsigned short GetListenPort | ( | ) |
Definition at line 100 of file net.cpp.
Referenced by TorController::add_onion_cb(), AddLocal(), AppInit2(), TorController::auth_cb(), and GetLocalAddress().
Definition at line 106 of file net.cpp.
Referenced by GetLocalAddress(), and CActiveMasternode::ManageStateInitial().
CAddress GetLocalAddress | ( | const CNetAddr * | paddrPeer, |
ServiceFlags | nLocalServices | ||
) |
Definition at line 155 of file net.cpp.
Referenced by AdvertiseLocal(), and ProcessMessage().
CNodeSignals& GetNodeSignals | ( | ) |
Definition at line 92 of file net.cpp.
Referenced by CConnman::AcceptConnection(), AppInit2(), CConnman::ConnectNode(), CConnman::DeleteNode(), PrepareShutdown(), CConnman::Start(), and CConnman::ThreadMessageHandler().
int GetnScore | ( | const CService & | addr | ) |
Definition at line 167 of file net.cpp.
Referenced by AdvertiseLocal().
bool IsLimited | ( | enum Network | net | ) |
Definition at line 253 of file net.cpp.
Referenced by AddLocal(), Bind(), GetNetworksInfo(), IsLimited(), IsPeerAddrLocalGood(), and CConnman::ThreadOpenConnections().
bool IsLocal | ( | const CService & | addr | ) |
check whether a given address is potentially local
Definition at line 278 of file net.cpp.
Referenced by CConnman::ConnectNode(), CConnman::OpenNetworkConnection(), and CConnman::ThreadOpenConnections().
bool IsPeerAddrLocalGood | ( | CNode * | pnode | ) |
Definition at line 176 of file net.cpp.
Referenced by AdvertiseLocal(), and ProcessMessage().
bool IsReachable | ( | enum Network | net | ) |
check whether a given network is one we can probably connect to
Definition at line 285 of file net.cpp.
Referenced by GetNetworksInfo(), IsReachable(), CMasternode::IsValidNetAddr(), and ProcessMessage().
bool IsReachable | ( | const CNetAddr & | addr | ) |
void MapPort | ( | bool | ) |
Definition at line 1511 of file net.cpp.
Referenced by AppInit2(), PrepareShutdown(), and OptionsModel::setData().
int64_t PoissonNextSend | ( | int64_t | nNow, |
int | average_interval_seconds | ||
) |
Return a timestamp in the future (in microseconds) for exponentially distributed events.
Definition at line 2892 of file net.cpp.
Referenced by SendMessages(), and CConnman::ThreadOpenConnections().
bool RemoveLocal | ( | const CService & | addr | ) |
Definition at line 236 of file net.cpp.
Referenced by TorController::disconnected_cb(), and TorController::~TorController().
|
static |
Definition at line 884 of file net.cpp.
Referenced by CConnman::AttemptToEvictConnection().
|
static |
Definition at line 889 of file net.cpp.
Referenced by CConnman::AttemptToEvictConnection().
bool SeenLocal | ( | const CService & | addr | ) |
void SetLimited | ( | enum Network | net, |
bool | fLimited | ||
) |
Make a particular network entirely off-limits (no automatic connects to it)
Definition at line 245 of file net.cpp.
Referenced by AppInit2(), and TorController::auth_cb().
CCriticalSection cs_mapLocalHost |
Definition at line 79 of file net.cpp.
Referenced by AddLocal(), GetLocal(), getnetworkinfo(), GetnScore(), IsLimited(), IsLocal(), IsReachable(), RemoveLocal(), SeenLocal(), and SetLimited().
CCriticalSection cs_mapRelay |
Definition at line 87 of file net.cpp.
Referenced by ProcessGetData(), and CConnman::RelayTransaction().
bool fDiscover = true |
Definition at line 76 of file net.cpp.
Referenced by AddLocal(), AppInit2(), CConnman::BindListenPort(), Discover(), and IsPeerAddrLocalGood().
bool fListen = true |
Definition at line 77 of file net.cpp.
Referenced by AdvertiseLocal(), AppInit2(), GetLocal(), CActiveMasternode::ManageStateInitial(), and ProcessMessage().
bool fRelayTxes = true |
Definition at line 78 of file net.cpp.
Referenced by AppInit2(), getnetworkinfo(), and ProcessMessage().
|
static |
Definition at line 91 of file net.cpp.
Referenced by GetNodeSignals().
class CNetCleanup instance_of_cnetcleanup |
limitedmap<uint256, int64_t> mapAlreadyAskedFor(MAX_INV_SZ) |
Referenced by CNode::AskFor(), and ProcessMessage().
std::map<CNetAddr, LocalServiceInfo> mapLocalHost |
Definition at line 80 of file net.cpp.
Referenced by AddLocal(), GetLocal(), getnetworkinfo(), GetnScore(), IsLocal(), RemoveLocal(), and SeenLocal().
std::map<CInv, CDataStream> mapRelay |
Definition at line 85 of file net.cpp.
Referenced by ProcessGetData(), and CConnman::RelayTransaction().
|
static |
Definition at line 68 of file net.cpp.
Referenced by CNode::CNode(), and CNode::ReceiveMsgBytes().
|
static |
Definition at line 82 of file net.cpp.
Referenced by CConnman::Start(), and CConnman::Stop().
std::string strSubVersion |
Subversion as sent to the P2P network in version
messages
Definition at line 83 of file net.cpp.
Referenced by AppInit2(), ClientModel::formatSubVersion(), and getnetworkinfo().
|
static |
Definition at line 81 of file net.cpp.
Referenced by IsLimited(), IsReachable(), and SetLimited().
std::deque<pair<int64_t, CInv> > vRelayExpiration |
Definition at line 86 of file net.cpp.
Referenced by CConnman::RelayTransaction().