Changeset View
Changeset View
Standalone View
Standalone View
src/net.h
Show First 20 Lines • Show All 526 Lines • ▼ Show 20 Lines | |||||
public: | public: | ||||
// Parsing header (false) or data (true) | // Parsing header (false) or data (true) | ||||
bool in_data; | bool in_data; | ||||
// Partially received header. | // Partially received header. | ||||
CDataStream hdrbuf; | CDataStream hdrbuf; | ||||
// Complete header. | // Complete header. | ||||
CMessageHeader hdr; | CMessageHeader hdr; | ||||
unsigned int nHdrPos; | uint32_t nHdrPos; | ||||
// Received message data. | // Received message data. | ||||
CDataStream vRecv; | CDataStream vRecv; | ||||
unsigned int nDataPos; | uint32_t nDataPos; | ||||
// Time (in microseconds) of message receipt. | // Time (in microseconds) of message receipt. | ||||
int64_t nTime; | int64_t nTime; | ||||
CNetMessage(const CMessageHeader::MessageMagic &pchMessageStartIn, | CNetMessage(const CMessageHeader::MessageMagic &pchMessageStartIn, | ||||
int nTypeIn, int nVersionIn) | int nTypeIn, int nVersionIn) | ||||
: hdrbuf(nTypeIn, nVersionIn), hdr(pchMessageStartIn), | : hdrbuf(nTypeIn, nVersionIn), hdr(pchMessageStartIn), | ||||
vRecv(nTypeIn, nVersionIn) { | vRecv(nTypeIn, nVersionIn) { | ||||
Show All 14 Lines | public: | ||||
const uint256 &GetMessageHash() const; | const uint256 &GetMessageHash() const; | ||||
void SetVersion(int nVersionIn) { | void SetVersion(int nVersionIn) { | ||||
hdrbuf.SetVersion(nVersionIn); | hdrbuf.SetVersion(nVersionIn); | ||||
vRecv.SetVersion(nVersionIn); | vRecv.SetVersion(nVersionIn); | ||||
} | } | ||||
int readHeader(const Config &config, const char *pch, unsigned int nBytes); | int readHeader(const Config &config, const char *pch, uint32_t nBytes); | ||||
int readData(const char *pch, unsigned int nBytes); | int readData(const char *pch, uint32_t nBytes); | ||||
}; | }; | ||||
/** Information about a peer */ | /** Information about a peer */ | ||||
class CNode { | class CNode { | ||||
friend class CConnman; | friend class CConnman; | ||||
public: | public: | ||||
// socket | // socket | ||||
▲ Show 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | public: | ||||
int GetMyStartingHeight() const { return nMyStartingHeight; } | int GetMyStartingHeight() const { return nMyStartingHeight; } | ||||
int GetRefCount() { | int GetRefCount() { | ||||
assert(nRefCount >= 0); | assert(nRefCount >= 0); | ||||
return nRefCount; | return nRefCount; | ||||
} | } | ||||
bool ReceiveMsgBytes(const Config &config, const char *pch, | bool ReceiveMsgBytes(const Config &config, const char *pch, uint32_t nBytes, | ||||
unsigned int nBytes, bool &complete); | bool &complete); | ||||
void SetRecvVersion(int nVersionIn) { nRecvVersion = nVersionIn; } | void SetRecvVersion(int nVersionIn) { nRecvVersion = nVersionIn; } | ||||
int GetRecvVersion() { return nRecvVersion; } | int GetRecvVersion() { return nRecvVersion; } | ||||
void SetSendVersion(int nVersionIn); | void SetSendVersion(int nVersionIn); | ||||
int GetSendVersion() const; | int GetSendVersion() const; | ||||
CService GetAddrLocal() const; | CService GetAddrLocal() const; | ||||
//! May not be called more than once | //! May not be called more than once | ||||
▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines |