|
|
@ -37,7 +37,7 @@ bool GetMyExternalIP(CNetAddr& ipRet);
|
|
|
|
void AddressCurrentlyConnected(const CService& addr);
|
|
|
|
void AddressCurrentlyConnected(const CService& addr);
|
|
|
|
CNode* FindNode(const CNetAddr& ip);
|
|
|
|
CNode* FindNode(const CNetAddr& ip);
|
|
|
|
CNode* FindNode(const CService& ip);
|
|
|
|
CNode* FindNode(const CService& ip);
|
|
|
|
CNode* ConnectNode(CAddress addrConnect, const char *strDest = NULL, int64 nTimeout=0);
|
|
|
|
CNode* ConnectNode(CAddress addrConnect, const char *strDest = NULL);
|
|
|
|
void MapPort(bool fUseUPnP);
|
|
|
|
void MapPort(bool fUseUPnP);
|
|
|
|
unsigned short GetListenPort();
|
|
|
|
unsigned short GetListenPort();
|
|
|
|
bool BindListenPort(const CService &bindAddr, std::string& strError=REF(std::string()));
|
|
|
|
bool BindListenPort(const CService &bindAddr, std::string& strError=REF(std::string()));
|
|
|
@ -99,7 +99,6 @@ public:
|
|
|
|
int nVersion;
|
|
|
|
int nVersion;
|
|
|
|
std::string strSubVer;
|
|
|
|
std::string strSubVer;
|
|
|
|
bool fInbound;
|
|
|
|
bool fInbound;
|
|
|
|
int64 nReleaseTime;
|
|
|
|
|
|
|
|
int nStartingHeight;
|
|
|
|
int nStartingHeight;
|
|
|
|
int nMisbehavior;
|
|
|
|
int nMisbehavior;
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -187,8 +186,8 @@ public:
|
|
|
|
CSemaphoreGrant grantOutbound;
|
|
|
|
CSemaphoreGrant grantOutbound;
|
|
|
|
CCriticalSection cs_filter;
|
|
|
|
CCriticalSection cs_filter;
|
|
|
|
CBloomFilter* pfilter;
|
|
|
|
CBloomFilter* pfilter;
|
|
|
|
protected:
|
|
|
|
|
|
|
|
int nRefCount;
|
|
|
|
int nRefCount;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
|
|
// Denial-of-service detection/prevention
|
|
|
|
// Denial-of-service detection/prevention
|
|
|
|
// Key is IP address, value is banned-until-time
|
|
|
|
// Key is IP address, value is banned-until-time
|
|
|
@ -197,7 +196,6 @@ protected:
|
|
|
|
int nMisbehavior;
|
|
|
|
int nMisbehavior;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
int64 nReleaseTime;
|
|
|
|
|
|
|
|
uint256 hashContinue;
|
|
|
|
uint256 hashContinue;
|
|
|
|
CBlockIndex* pindexLastGetBlocksBegin;
|
|
|
|
CBlockIndex* pindexLastGetBlocksBegin;
|
|
|
|
uint256 hashLastGetBlocksEnd;
|
|
|
|
uint256 hashLastGetBlocksEnd;
|
|
|
@ -235,7 +233,6 @@ public:
|
|
|
|
fSuccessfullyConnected = false;
|
|
|
|
fSuccessfullyConnected = false;
|
|
|
|
fDisconnect = false;
|
|
|
|
fDisconnect = false;
|
|
|
|
nRefCount = 0;
|
|
|
|
nRefCount = 0;
|
|
|
|
nReleaseTime = 0;
|
|
|
|
|
|
|
|
nSendSize = 0;
|
|
|
|
nSendSize = 0;
|
|
|
|
nSendOffset = 0;
|
|
|
|
nSendOffset = 0;
|
|
|
|
hashContinue = 0;
|
|
|
|
hashContinue = 0;
|
|
|
@ -272,7 +269,8 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
int GetRefCount()
|
|
|
|
int GetRefCount()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return std::max(nRefCount, 0) + (GetTime() < nReleaseTime ? 1 : 0);
|
|
|
|
assert(nRefCount >= 0);
|
|
|
|
|
|
|
|
return nRefCount;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// requires LOCK(cs_vRecvMsg)
|
|
|
|
// requires LOCK(cs_vRecvMsg)
|
|
|
@ -295,12 +293,9 @@ public:
|
|
|
|
msg.SetVersion(nVersionIn);
|
|
|
|
msg.SetVersion(nVersionIn);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CNode* AddRef(int64 nTimeout=0)
|
|
|
|
CNode* AddRef()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (nTimeout != 0)
|
|
|
|
nRefCount++;
|
|
|
|
nReleaseTime = std::max(nReleaseTime, GetTime() + nTimeout);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
nRefCount++;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|