aboutsummaryrefslogtreecommitdiff
path: root/net.h
diff options
context:
space:
mode:
authors_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-11-18 19:19:41 +0000
committers_nakamoto <s_nakamoto@1a98c847-1fd6-4fd8-948a-caf3550aa51b>2009-11-18 19:19:41 +0000
commite4db374421cac4c6fd0d9f9b337d9073e5207c21 (patch)
treebfbb16bc8fbcb4911a24a5e32f9f4c3c280f392c /net.h
parent01fe1d2137d5e0a1d38f4c3be241b69ceccc578c (diff)
downloadbitcoin-e4db374421cac4c6fd0d9f9b337d9073e5207c21.tar.xz
bugfix Db::open/close and zombie sockets bugs fix double-close of socket handle,
keep databases open, close db cursors, initial block download in batches of 500 blocks, fix misc warnings, subver linux-test8
Diffstat (limited to 'net.h')
-rw-r--r--net.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/net.h b/net.h
index 65bbb96077..7d71be49da 100644
--- a/net.h
+++ b/net.h
@@ -414,7 +414,7 @@ public:
string ToString() const
{
- return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,14).c_str());
+ return strprintf("%s %s", GetCommand(), hash.ToString().substr(0,16).c_str());
}
void print() const
@@ -504,6 +504,7 @@ public:
int64 nReleaseTime;
map<uint256, CRequestTracker> mapRequests;
CCriticalSection cs_mapRequests;
+ uint256 hashContinue;
// flood
vector<CAddress> vAddrToSend;
@@ -512,7 +513,6 @@ public:
// inventory based relay
set<CInv> setInventoryKnown;
- set<CInv> setInventoryKnown2;
vector<CInv> vInventoryToSend;
CCriticalSection cs_inventory;
multimap<int64, CInv> mapAskFor;
@@ -541,6 +541,7 @@ public:
fDisconnect = false;
nRefCount = 0;
nReleaseTime = 0;
+ hashContinue = 0;
fGetAddr = false;
vfSubscribe.assign(256, false);
@@ -550,13 +551,16 @@ public:
CAddress addrYou = (fUseProxy ? CAddress("0.0.0.0") : addr);
CAddress addrMe = (fUseProxy ? CAddress("0.0.0.0") : addrLocalHost);
RAND_bytes((unsigned char*)&nLocalHostNonce, sizeof(nLocalHostNonce));
- PushMessage("version", VERSION, nLocalServices, nTime, addrYou, addrMe, nLocalHostNonce, string("test5"));
+ PushMessage("version", VERSION, nLocalServices, nTime, addrYou, addrMe, nLocalHostNonce, string(pszSubVer));
}
~CNode()
{
if (hSocket != INVALID_SOCKET)
+ {
closesocket(hSocket);
+ hSocket = INVALID_SOCKET;
+ }
}
private:
@@ -570,12 +574,13 @@ public:
return max(nRefCount, 0) + (GetTime() < nReleaseTime ? 1 : 0);
}
- void AddRef(int64 nTimeout=0)
+ CNode* AddRef(int64 nTimeout=0)
{
if (nTimeout != 0)
nReleaseTime = max(nReleaseTime, GetTime() + nTimeout);
else
nRefCount++;
+ return this;
}
void Release()
@@ -899,7 +904,8 @@ public:
bool IsSubscribed(unsigned int nChannel);
void Subscribe(unsigned int nChannel, unsigned int nHops=0);
void CancelSubscribe(unsigned int nChannel);
- void DoDisconnect();
+ void CloseSocketDisconnect();
+ void Cleanup();
};