net: remove now-unused ssSend and Fuzz
This commit is contained in:
parent
5c2169cc3f
commit
440f1d3e4c
2 changed files with 1 additions and 41 deletions
38
src/net.cpp
38
src/net.cpp
|
@ -1063,7 +1063,7 @@ void CConnman::ThreadSocketHandler()
|
|||
BOOST_FOREACH(CNode* pnode, vNodesCopy)
|
||||
{
|
||||
if (pnode->fDisconnect ||
|
||||
(pnode->GetRefCount() <= 0 && pnode->vRecvMsg.empty() && pnode->nSendSize == 0 && pnode->ssSend.empty()))
|
||||
(pnode->GetRefCount() <= 0 && pnode->vRecvMsg.empty() && pnode->nSendSize == 0))
|
||||
{
|
||||
// remove from vNodes
|
||||
vNodes.erase(remove(vNodes.begin(), vNodes.end(), pnode), vNodes.end());
|
||||
|
@ -2482,46 +2482,10 @@ int CConnman::GetBestHeight() const
|
|||
return nBestHeight.load(std::memory_order_acquire);
|
||||
}
|
||||
|
||||
void CNode::Fuzz(int nChance)
|
||||
{
|
||||
if (!fSuccessfullyConnected) return; // Don't fuzz initial handshake
|
||||
if (GetRand(nChance) != 0) return; // Fuzz 1 of every nChance messages
|
||||
|
||||
switch (GetRand(3))
|
||||
{
|
||||
case 0:
|
||||
// xor a random byte with a random value:
|
||||
if (!ssSend.empty()) {
|
||||
CDataStream::size_type pos = GetRand(ssSend.size());
|
||||
ssSend[pos] ^= (unsigned char)(GetRand(256));
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
// delete a random byte:
|
||||
if (!ssSend.empty()) {
|
||||
CDataStream::size_type pos = GetRand(ssSend.size());
|
||||
ssSend.erase(ssSend.begin()+pos);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// insert a random byte at a random position
|
||||
{
|
||||
CDataStream::size_type pos = GetRand(ssSend.size());
|
||||
char ch = (char)GetRand(256);
|
||||
ssSend.insert(ssSend.begin()+pos, ch);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Chance of more than one change half the time:
|
||||
// (more changes exponentially less likely):
|
||||
Fuzz(2);
|
||||
}
|
||||
|
||||
unsigned int CConnman::GetReceiveFloodSize() const { return nReceiveFloodSize; }
|
||||
unsigned int CConnman::GetSendBufferSize() const{ return nSendBufferMaxSize; }
|
||||
|
||||
CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn, SOCKET hSocketIn, const CAddress& addrIn, uint64_t nKeyedNetGroupIn, uint64_t nLocalHostNonceIn, const std::string& addrNameIn, bool fInboundIn) :
|
||||
ssSend(SER_NETWORK, INIT_PROTO_VERSION),
|
||||
addr(addrIn),
|
||||
fInbound(fInboundIn),
|
||||
id(idIn),
|
||||
|
|
|
@ -593,7 +593,6 @@ public:
|
|||
ServiceFlags nServices;
|
||||
ServiceFlags nServicesExpected;
|
||||
SOCKET hSocket;
|
||||
CDataStream ssSend;
|
||||
size_t nSendSize; // total size of all vSendMsg entries
|
||||
size_t nSendOffset; // offset inside the first vSendMsg already sent
|
||||
uint64_t nSendBytes;
|
||||
|
@ -645,9 +644,6 @@ protected:
|
|||
mapMsgCmdSize mapSendBytesPerMsgCmd;
|
||||
mapMsgCmdSize mapRecvBytesPerMsgCmd;
|
||||
|
||||
// Basic fuzz-testing
|
||||
void Fuzz(int nChance); // modifies ssSend
|
||||
|
||||
public:
|
||||
uint256 hashContinue;
|
||||
int nStartingHeight;
|
||||
|
|
Loading…
Reference in a new issue