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