Add new flag -maxpptime (default 600 for 10 minutes)
@@ -4601,10 +4601,13 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
// Loop through current peer nodes and check their current Sent Bytes, should be okay on performance even with lots of peers
// If peer node has sent over 10MB of data, then disconnect it and add it to our banned list for 24 hours
+ // -maxpp=10000000 (10MB)
+ // -maxpptime=600 (10 minutes)
LOCK(cs_vNodes);
for (CNode* pnode : vNodes)
{
- if (pnode->nSendBytes >= GetArg("-maxpp", 10000000)) //10000000 = 10MB -maxpp=10000000 flag default
+ // check if the peer has been connected for more than 10 minutes -maxpptime default 600 for 10 mins, if so, dont disconnect/ban it
+ if (pnode->nSendBytes >= GetArg("-maxpp", 10000000) && GetTime() - pnode->nTimeConnected < GetArg("-maxpptime", 10*60)) //10000000 = 10MB -maxpp=10000000 flag default
{
printf("Disconnecting and Banning Node: %s, Too Many SendBytes = %" PRIszu"\n", pnode->addr.ToString().c_str(), pnode->nSendBytes);
pnode->fDisconnect = true;
