|
|
|
@ -182,6 +182,7 @@ struct LocalServiceInfo {
@@ -182,6 +182,7 @@ struct LocalServiceInfo {
|
|
|
|
|
|
|
|
|
|
extern CCriticalSection cs_mapLocalHost; |
|
|
|
|
extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost; |
|
|
|
|
typedef std::map<std::string, uint64_t> mapMsgCmdSize; //command, total bytes
|
|
|
|
|
|
|
|
|
|
class CNodeStats |
|
|
|
|
{ |
|
|
|
@ -199,7 +200,9 @@ public:
@@ -199,7 +200,9 @@ public:
|
|
|
|
|
bool fInbound; |
|
|
|
|
int nStartingHeight; |
|
|
|
|
uint64_t nSendBytes; |
|
|
|
|
mapMsgCmdSize mapSendBytesPerMsgCmd; |
|
|
|
|
uint64_t nRecvBytes; |
|
|
|
|
mapMsgCmdSize mapRecvBytesPerMsgCmd; |
|
|
|
|
bool fWhitelisted; |
|
|
|
|
double dPingTime; |
|
|
|
|
double dPingWait; |
|
|
|
@ -373,6 +376,9 @@ protected:
@@ -373,6 +376,9 @@ protected:
|
|
|
|
|
static std::vector<CSubNet> vWhitelistedRange; |
|
|
|
|
static CCriticalSection cs_vWhitelistedRange; |
|
|
|
|
|
|
|
|
|
mapMsgCmdSize mapSendBytesPerMsgCmd; |
|
|
|
|
mapMsgCmdSize mapRecvBytesPerMsgCmd; |
|
|
|
|
|
|
|
|
|
// Basic fuzz-testing
|
|
|
|
|
void Fuzz(int nChance); // modifies ssSend
|
|
|
|
|
|
|
|
|
@ -525,7 +531,7 @@ public:
@@ -525,7 +531,7 @@ public:
|
|
|
|
|
void AbortMessage() UNLOCK_FUNCTION(cs_vSend); |
|
|
|
|
|
|
|
|
|
// TODO: Document the precondition of this function. Is cs_vSend locked?
|
|
|
|
|
void EndMessage() UNLOCK_FUNCTION(cs_vSend); |
|
|
|
|
void EndMessage(const char* pszCommand) UNLOCK_FUNCTION(cs_vSend); |
|
|
|
|
|
|
|
|
|
void PushVersion(); |
|
|
|
|
|
|
|
|
@ -535,7 +541,7 @@ public:
@@ -535,7 +541,7 @@ public:
|
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
BeginMessage(pszCommand); |
|
|
|
|
EndMessage(); |
|
|
|
|
EndMessage(pszCommand); |
|
|
|
|
} |
|
|
|
|
catch (...) |
|
|
|
|
{ |
|
|
|
@ -551,7 +557,7 @@ public:
@@ -551,7 +557,7 @@ public:
|
|
|
|
|
{ |
|
|
|
|
BeginMessage(pszCommand); |
|
|
|
|
ssSend << a1; |
|
|
|
|
EndMessage(); |
|
|
|
|
EndMessage(pszCommand); |
|
|
|
|
} |
|
|
|
|
catch (...) |
|
|
|
|
{ |
|
|
|
@ -567,7 +573,7 @@ public:
@@ -567,7 +573,7 @@ public:
|
|
|
|
|
{ |
|
|
|
|
BeginMessage(pszCommand); |
|
|
|
|
ssSend << a1 << a2; |
|
|
|
|
EndMessage(); |
|
|
|
|
EndMessage(pszCommand); |
|
|
|
|
} |
|
|
|
|
catch (...) |
|
|
|
|
{ |
|
|
|
@ -583,7 +589,7 @@ public:
@@ -583,7 +589,7 @@ public:
|
|
|
|
|
{ |
|
|
|
|
BeginMessage(pszCommand); |
|
|
|
|
ssSend << a1 << a2 << a3; |
|
|
|
|
EndMessage(); |
|
|
|
|
EndMessage(pszCommand); |
|
|
|
|
} |
|
|
|
|
catch (...) |
|
|
|
|
{ |
|
|
|
@ -599,7 +605,7 @@ public:
@@ -599,7 +605,7 @@ public:
|
|
|
|
|
{ |
|
|
|
|
BeginMessage(pszCommand); |
|
|
|
|
ssSend << a1 << a2 << a3 << a4; |
|
|
|
|
EndMessage(); |
|
|
|
|
EndMessage(pszCommand); |
|
|
|
|
} |
|
|
|
|
catch (...) |
|
|
|
|
{ |
|
|
|
@ -615,7 +621,7 @@ public:
@@ -615,7 +621,7 @@ public:
|
|
|
|
|
{ |
|
|
|
|
BeginMessage(pszCommand); |
|
|
|
|
ssSend << a1 << a2 << a3 << a4 << a5; |
|
|
|
|
EndMessage(); |
|
|
|
|
EndMessage(pszCommand); |
|
|
|
|
} |
|
|
|
|
catch (...) |
|
|
|
|
{ |
|
|
|
@ -631,7 +637,7 @@ public:
@@ -631,7 +637,7 @@ public:
|
|
|
|
|
{ |
|
|
|
|
BeginMessage(pszCommand); |
|
|
|
|
ssSend << a1 << a2 << a3 << a4 << a5 << a6; |
|
|
|
|
EndMessage(); |
|
|
|
|
EndMessage(pszCommand); |
|
|
|
|
} |
|
|
|
|
catch (...) |
|
|
|
|
{ |
|
|
|
@ -647,7 +653,7 @@ public:
@@ -647,7 +653,7 @@ public:
|
|
|
|
|
{ |
|
|
|
|
BeginMessage(pszCommand); |
|
|
|
|
ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7; |
|
|
|
|
EndMessage(); |
|
|
|
|
EndMessage(pszCommand); |
|
|
|
|
} |
|
|
|
|
catch (...) |
|
|
|
|
{ |
|
|
|
@ -663,7 +669,7 @@ public:
@@ -663,7 +669,7 @@ public:
|
|
|
|
|
{ |
|
|
|
|
BeginMessage(pszCommand); |
|
|
|
|
ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8; |
|
|
|
|
EndMessage(); |
|
|
|
|
EndMessage(pszCommand); |
|
|
|
|
} |
|
|
|
|
catch (...) |
|
|
|
|
{ |
|
|
|
@ -679,7 +685,7 @@ public:
@@ -679,7 +685,7 @@ public:
|
|
|
|
|
{ |
|
|
|
|
BeginMessage(pszCommand); |
|
|
|
|
ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9; |
|
|
|
|
EndMessage(); |
|
|
|
|
EndMessage(pszCommand); |
|
|
|
|
} |
|
|
|
|
catch (...) |
|
|
|
|
{ |
|
|
|
|