![]() |
Master Core
v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
|
Information about a peer. More...
#include <net.h>
Public Member Functions | |
CNode (SOCKET hSocketIn, CAddress addrIn, std::string addrNameIn="", bool fInboundIn=false) | |
~CNode () | |
NodeId | GetId () const |
int | GetRefCount () |
unsigned int | GetTotalRecvSize () |
bool | ReceiveMsgBytes (const char *pch, unsigned int nBytes) |
void | SetRecvVersion (int nVersionIn) |
CNode * | AddRef () |
void | Release () |
void | AddAddressKnown (const CAddress &addr) |
void | PushAddress (const CAddress &addr) |
void | AddInventoryKnown (const CInv &inv) |
void | PushInventory (const CInv &inv) |
void | AskFor (const CInv &inv) |
void | BeginMessage (const char *pszCommand) EXCLUSIVE_LOCK_FUNCTION(cs_vSend) |
void | AbortMessage () UNLOCK_FUNCTION(cs_vSend) |
void | EndMessage () UNLOCK_FUNCTION(cs_vSend) |
void | PushVersion () |
void | PushMessage (const char *pszCommand) |
template<typename T1 > | |
void | PushMessage (const char *pszCommand, const T1 &a1) |
template<typename T1 , typename T2 > | |
void | PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2) |
template<typename T1 , typename T2 , typename T3 > | |
void | PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3) |
template<typename T1 , typename T2 , typename T3 , typename T4 > | |
void | PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4) |
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 > | |
void | PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5) |
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 > | |
void | PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6) |
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 > | |
void | PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6, const T7 &a7) |
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 > | |
void | PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6, const T7 &a7, const T8 &a8) |
template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 , typename T6 , typename T7 , typename T8 , typename T9 > | |
void | PushMessage (const char *pszCommand, const T1 &a1, const T2 &a2, const T3 &a3, const T4 &a4, const T5 &a5, const T6 &a6, const T7 &a7, const T8 &a8, const T9 &a9) |
bool | IsSubscribed (unsigned int nChannel) |
void | Subscribe (unsigned int nChannel, unsigned int nHops=0) |
void | CancelSubscribe (unsigned int nChannel) |
void | CloseSocketDisconnect () |
void | Cleanup () |
void | copyStats (CNodeStats &stats) |
Static Public Member Functions | |
static void | ClearBanned () |
static bool | IsBanned (CNetAddr ip) |
static bool | Ban (const CNetAddr &ip) |
static void | RecordBytesRecv (uint64_t bytes) |
static void | RecordBytesSent (uint64_t bytes) |
static uint64_t | GetTotalBytesRecv () |
static uint64_t | GetTotalBytesSent () |
Protected Member Functions | |
void | Fuzz (int nChance) |
Static Protected Attributes | |
static std::map< CNetAddr, int64_t > | setBanned |
static CCriticalSection | cs_setBanned |
Private Member Functions | |
CNode (const CNode &) | |
void | operator= (const CNode &) |
Static Private Attributes | |
static CCriticalSection | cs_totalBytesRecv |
static CCriticalSection | cs_totalBytesSent |
static uint64_t | nTotalBytesRecv = 0 |
static uint64_t | nTotalBytesSent = 0 |
|
inline |
Definition at line 276 of file net.h.
References GetId(), GetNodeSignals(), GetTime(), INIT_PROTO_VERSION, CNodeSignals::InitializeNode, INVALID_SOCKET, LOCK, mruset< T >::max_size(), PushVersion(), SendBufferSize(), and CService::ToStringIPPort().
|
inline |
Definition at line 326 of file net.h.
References closesocket, CNodeSignals::FinalizeNode, GetId(), GetNodeSignals(), INVALID_SOCKET, and pfilter.
|
private |
|
inline |
Definition at line 468 of file net.h.
References CDataStream::clear(), LEAVE_CRITICAL_SECTION, and LogPrint().
Referenced by EndMessage(), and PushMessage().
|
inline |
Definition at line 393 of file net.h.
References mruset< T >::insert().
Referenced by ProcessMessage().
|
inline |
Definition at line 408 of file net.h.
References mruset< T >::insert(), and LOCK.
Referenced by ProcessMessage().
|
inline |
Definition at line 380 of file net.h.
Referenced by ConnectNode(), ThreadMessageHandler(), and ThreadSocketHandler().
|
inline |
Definition at line 425 of file net.h.
References DateTimeStrFormat(), limitedmap< K, V >::end(), limitedmap< K, V >::find(), GetTimeMicros(), limitedmap< K, V >::insert(), LogPrint(), MAPASKFOR_MAX_SZ, CInv::ToString(), and limitedmap< K, V >::update().
Referenced by ProcessMessage().
|
static |
|
inline |
Definition at line 459 of file net.h.
References ENTER_CRITICAL_SECTION, LogPrint(), and CDataStream::size().
Referenced by PushMessage().
void CNode::CancelSubscribe | ( | unsigned int | nChannel | ) |
void CNode::Cleanup | ( | ) |
Definition at line 517 of file net.cpp.
Referenced by ThreadSocketHandler().
void CNode::CloseSocketDisconnect | ( | ) |
Definition at line 497 of file net.cpp.
References closesocket, INVALID_SOCKET, LogPrint(), and TRY_LOCK.
Referenced by SocketSendData(), ThreadMessageHandler(), and ThreadSocketHandler().
void CNode::copyStats | ( | CNodeStats & | stats | ) |
Definition at line 576 of file net.cpp.
References CNodeStats::addrLocal, CNodeStats::dPingTime, CNodeStats::dPingWait, CNodeStats::fSyncNode, GetTimeMicros(), CNodeStats::nodeid, pnodeSync, and X.
Referenced by CopyNodeStats().
|
inline |
Definition at line 478 of file net.h.
References AbortMessage(), CDataStream::begin(), CDataStream::end(), Fuzz(), CDataStream::GetAndClear(), GetArg(), GetRand(), Hash(), LEAVE_CRITICAL_SECTION, LogPrint(), mapArgs, memcpy(), CDataStream::size(), and SocketSendData().
Referenced by PushMessage().
|
protected |
Definition at line 1870 of file net.cpp.
References GetRand().
Referenced by EndMessage().
|
inline |
Definition at line 350 of file net.h.
References id.
Referenced by CNode(), ProcessMessage(), SendMessages(), and ~CNode().
|
inline |
Definition at line 354 of file net.h.
References nRefCount.
Referenced by ThreadSocketHandler().
|
static |
Definition at line 1858 of file net.cpp.
References LOCK.
Referenced by getnettotals(), and ClientModel::getTotalBytesRecv().
|
static |
Definition at line 1864 of file net.cpp.
References LOCK.
Referenced by getnettotals(), and ClientModel::getTotalBytesSent().
|
inline |
Definition at line 361 of file net.h.
References CDataStream::size(), and CNetMessage::vRecv.
Referenced by ThreadSocketHandler().
|
static |
Definition at line 548 of file net.cpp.
References GetTime(), and LOCK.
Referenced by OpenNetworkConnection(), and ThreadSocketHandler().
bool CNode::IsSubscribed | ( | unsigned int | nChannel | ) |
|
private |
|
inline |
Definition at line 398 of file net.h.
References mruset< T >::count(), and CNetAddr::IsValid().
Referenced by AdvertizeLocal(), ProcessMessage(), and SendMessages().
|
inline |
Definition at line 416 of file net.h.
References mruset< T >::count(), and LOCK.
Referenced by AcceptBlock(), ProcessMessage(), and RelayTransaction().
|
inline |
Definition at line 522 of file net.h.
References AbortMessage(), BeginMessage(), and EndMessage().
Referenced by ProcessGetData(), ProcessMessage(), ProcessMessages(), PushGetBlocks(), CAlert::RelayTo(), and SendMessages().
|
inline |
Definition at line 537 of file net.h.
References AbortMessage(), BeginMessage(), and EndMessage().
|
inline |
Definition at line 553 of file net.h.
References AbortMessage(), BeginMessage(), and EndMessage().
|
inline |
Definition at line 569 of file net.h.
References AbortMessage(), BeginMessage(), and EndMessage().
|
inline |
Definition at line 585 of file net.h.
References AbortMessage(), BeginMessage(), and EndMessage().
|
inline |
Definition at line 601 of file net.h.
References AbortMessage(), BeginMessage(), and EndMessage().
|
inline |
Definition at line 617 of file net.h.
References AbortMessage(), BeginMessage(), and EndMessage().
|
inline |
Definition at line 633 of file net.h.
References AbortMessage(), BeginMessage(), and EndMessage().
|
inline |
Definition at line 649 of file net.h.
References AbortMessage(), BeginMessage(), and EndMessage().
|
inline |
Definition at line 665 of file net.h.
References AbortMessage(), BeginMessage(), and EndMessage().
void CNode::PushVersion | ( | ) |
when NTP implemented, change to just nTime = GetAdjustedTime()
Definition at line 522 of file net.cpp.
References CLIENT_NAME, CLIENT_VERSION, FormatSubVersion(), GetAdjustedTime(), CNodeSignals::GetHeight, GetLocalAddress(), GetTime(), IsProxy(), LogPrint(), nLocalHostNonce, nLocalServices, PROTOCOL_VERSION, and CService::ToString().
Referenced by CNode(), and ProcessMessage().
bool CNode::ReceiveMsgBytes | ( | const char * | pch, |
unsigned int | nBytes | ||
) |
Definition at line 613 of file net.cpp.
References CNetMessage::in_data, CNetMessage::readData(), CNetMessage::readHeader(), and SER_NETWORK.
Referenced by ThreadSocketHandler().
|
static |
Definition at line 1846 of file net.cpp.
References LOCK.
Referenced by ThreadSocketHandler().
|
static |
Definition at line 1852 of file net.cpp.
References LOCK.
Referenced by SocketSendData().
|
inline |
Definition at line 386 of file net.h.
Referenced by ThreadMessageHandler(), and ThreadSocketHandler().
|
inline |
Definition at line 373 of file net.h.
References CNetMessage::SetVersion().
Referenced by ProcessMessage().
CAddress CNode::addr |
Definition at line 216 of file net.h.
Referenced by AdvertizeLocal(), FindNode(), getaddednodeinfo(), ProcessMessage(), SendMessages(), ThreadOpenAddedConnections(), and ThreadOpenConnections().
CService CNode::addrLocal |
Definition at line 218 of file net.h.
Referenced by AdvertizeLocal(), and ProcessMessage().
std::string CNode::addrName |
Definition at line 217 of file net.h.
Referenced by FindNode().
std::string CNode::cleanSubVer |
Definition at line 224 of file net.h.
Referenced by ProcessMessage().
CCriticalSection CNode::cs_filter |
Definition at line 237 of file net.h.
Referenced by ProcessGetData(), ProcessMessage(), and RelayTransaction().
CCriticalSection CNode::cs_inventory |
Definition at line 267 of file net.h.
Referenced by SendMessages(), and ThreadSocketHandler().
|
staticprotected |
|
staticprivate |
|
staticprivate |
CCriticalSection CNode::cs_vRecvMsg |
Definition at line 208 of file net.h.
Referenced by ThreadMessageHandler(), and ThreadSocketHandler().
CCriticalSection CNode::cs_vSend |
Definition at line 204 of file net.h.
Referenced by ThreadMessageHandler(), and ThreadSocketHandler().
bool CNode::fClient |
Definition at line 226 of file net.h.
Referenced by ProcessMessage(), and StartSync().
bool CNode::fDisconnect |
Definition at line 230 of file net.h.
Referenced by ProcessMessage(), ProcessMessages(), SendMessages(), StartSync(), ThreadMessageHandler(), and ThreadSocketHandler().
bool CNode::fGetAddr |
Definition at line 261 of file net.h.
Referenced by ProcessMessage().
bool CNode::fInbound |
Definition at line 227 of file net.h.
Referenced by getaddednodeinfo(), ClientModel::getNumConnections(), ProcessMessage(), ThreadOpenConnections(), and ThreadSocketHandler().
bool CNode::fNetworkNode |
Definition at line 228 of file net.h.
Referenced by OpenNetworkConnection(), ProcessMessage(), and ThreadSocketHandler().
bool CNode::fOneShot |
Definition at line 225 of file net.h.
Referenced by OpenNetworkConnection(), ProcessMessage(), and StartSync().
bool CNode::fPingQueued |
Definition at line 274 of file net.h.
Referenced by ping(), and SendMessages().
bool CNode::fRelayTxes |
Definition at line 235 of file net.h.
Referenced by ProcessMessage(), and RelayTransaction().
bool CNode::fStartSync |
Definition at line 256 of file net.h.
Referenced by SendMessages(), and StartSync().
bool CNode::fSuccessfullyConnected |
Definition at line 229 of file net.h.
Referenced by AdvertizeLocal(), ProcessMessage(), and StartSync().
CSemaphoreGrant CNode::grantOutbound |
Definition at line 236 of file net.h.
Referenced by OpenNetworkConnection(), and ThreadSocketHandler().
uint256 CNode::hashContinue |
Definition at line 252 of file net.h.
Referenced by ProcessGetData(), and ProcessMessage().
uint256 CNode::hashLastGetBlocksEnd |
Definition at line 254 of file net.h.
Referenced by PushGetBlocks().
SOCKET CNode::hSocket |
Definition at line 198 of file net.h.
Referenced by SocketSendData(), ThreadSocketHandler(), and CNetCleanup::~CNetCleanup().
std::multimap<int64_t, CInv> CNode::mapAskFor |
Definition at line 268 of file net.h.
Referenced by SendMessages().
int64_t CNode::nLastRecv |
Definition at line 213 of file net.h.
Referenced by NodeSyncScore(), and ThreadSocketHandler().
int64_t CNode::nLastSend |
Definition at line 212 of file net.h.
Referenced by SendMessages(), SocketSendData(), and ThreadSocketHandler().
int64_t CNode::nLastSendEmpty |
Definition at line 214 of file net.h.
Referenced by ThreadSocketHandler().
uint64_t CNode::nPingNonceSent |
Definition at line 271 of file net.h.
Referenced by ProcessMessage(), and SendMessages().
int64_t CNode::nPingUsecStart |
Definition at line 272 of file net.h.
Referenced by ProcessMessage(), and SendMessages().
int64_t CNode::nPingUsecTime |
Definition at line 273 of file net.h.
Referenced by ProcessMessage().
uint64_t CNode::nRecvBytes |
Definition at line 209 of file net.h.
Referenced by ThreadSocketHandler().
int CNode::nRefCount |
Definition at line 239 of file net.h.
Referenced by GetRefCount().
uint64_t CNode::nSendBytes |
Definition at line 202 of file net.h.
Referenced by SocketSendData().
size_t CNode::nSendOffset |
Definition at line 201 of file net.h.
Referenced by SocketSendData().
size_t CNode::nSendSize |
Definition at line 200 of file net.h.
Referenced by ProcessGetData(), ProcessMessage(), ProcessMessages(), SocketSendData(), ThreadMessageHandler(), and ThreadSocketHandler().
uint64_t CNode::nServices |
Definition at line 197 of file net.h.
Referenced by ProcessMessage().
int CNode::nStartingHeight |
Definition at line 255 of file net.h.
Referenced by AcceptBlock(), ProcessMessage(), and StartSync().
int64_t CNode::nTimeConnected |
Definition at line 215 of file net.h.
Referenced by ConnectNode(), and ThreadSocketHandler().
int CNode::nVersion |
Definition at line 219 of file net.h.
Referenced by ProcessMessage(), CAlert::RelayTo(), SendMessages(), and StartSync().
CBloomFilter* CNode::pfilter |
Definition at line 238 of file net.h.
Referenced by ProcessGetData(), ProcessMessage(), RelayTransaction(), and ~CNode().
CBlockIndex* CNode::pindexLastGetBlocksBegin |
Definition at line 253 of file net.h.
Referenced by PushGetBlocks().
Definition at line 260 of file net.h.
Referenced by SendMessages().
|
staticprotected |
Definition at line 265 of file net.h.
Referenced by ProcessGetData(), and SendMessages().
std::set<uint256> CNode::setKnown |
Definition at line 262 of file net.h.
Referenced by ProcessMessage(), and CAlert::RelayTo().
CDataStream CNode::ssSend |
Definition at line 199 of file net.h.
Referenced by ProcessMessage(), and ThreadSocketHandler().
std::string CNode::strSubVer |
Definition at line 224 of file net.h.
Referenced by ProcessMessage(), and CAlert::RelayTo().
std::vector<CAddress> CNode::vAddrToSend |
Definition at line 259 of file net.h.
Referenced by ProcessMessage(), and SendMessages().
std::vector<CInv> CNode::vInventoryToSend |
Definition at line 266 of file net.h.
Referenced by SendMessages().
std::deque<CInv> CNode::vRecvGetData |
Definition at line 206 of file net.h.
Referenced by ProcessGetData(), ProcessMessage(), ProcessMessages(), and ThreadMessageHandler().
std::deque<CNetMessage> CNode::vRecvMsg |
Definition at line 207 of file net.h.
Referenced by ProcessMessages(), ThreadMessageHandler(), and ThreadSocketHandler().
std::deque<CSerializeData> CNode::vSendMsg |
Definition at line 203 of file net.h.
Referenced by SendMessages(), SocketSendData(), and ThreadSocketHandler().