mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
Merge pull request #4878
540ac45
Avoid returning many "inv" orphans (Jeff Garzik)d4168c8
Limit CNode::mapAskFor (Wladimir J. van der Laan)
This commit is contained in:
commit
d6af9856b0
@ -3641,6 +3641,11 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
|
|
||||||
// Track requests for our stuff
|
// Track requests for our stuff
|
||||||
g_signals.Inventory(inv.hash);
|
g_signals.Inventory(inv.hash);
|
||||||
|
|
||||||
|
if (pfrom->nSendSize > (SendBufferSize() * 2)) {
|
||||||
|
Misbehaving(pfrom->GetId(), 50);
|
||||||
|
return error("send buffer size() = %u", pfrom->nSendSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2106,6 +2106,8 @@ CNode::~CNode()
|
|||||||
|
|
||||||
void CNode::AskFor(const CInv& inv)
|
void CNode::AskFor(const CInv& inv)
|
||||||
{
|
{
|
||||||
|
if (mapAskFor.size() > MAPASKFOR_MAX_SZ)
|
||||||
|
return;
|
||||||
// We're using mapAskFor as a priority queue,
|
// We're using mapAskFor as a priority queue,
|
||||||
// the key is the earliest time the request can be sent
|
// the key is the earliest time the request can be sent
|
||||||
int64_t nRequestTime;
|
int64_t nRequestTime;
|
||||||
|
@ -51,6 +51,8 @@ static const bool DEFAULT_UPNP = USE_UPNP;
|
|||||||
#else
|
#else
|
||||||
static const bool DEFAULT_UPNP = false;
|
static const bool DEFAULT_UPNP = false;
|
||||||
#endif
|
#endif
|
||||||
|
/** The maximum number of entries in mapAskFor */
|
||||||
|
static const size_t MAPASKFOR_MAX_SZ = MAX_INV_SZ;
|
||||||
|
|
||||||
unsigned int ReceiveFloodSize();
|
unsigned int ReceiveFloodSize();
|
||||||
unsigned int SendBufferSize();
|
unsigned int SendBufferSize();
|
||||||
|
Loading…
Reference in New Issue
Block a user