Randomize order of processing messages from peers
This commit is contained in:
@@ -1945,6 +1945,11 @@ void ThreadMessageHandler()
|
|||||||
|
|
||||||
bool fSleep = true;
|
bool fSleep = true;
|
||||||
|
|
||||||
|
// Randomize the order in which we process messages from/to our peers.
|
||||||
|
// This prevents attacks in which an attacker exploits having multiple
|
||||||
|
// consecutive connections in the vNodes list.
|
||||||
|
random_shuffle(vNodesCopy.begin(), vNodesCopy.end(), GetRandInt);
|
||||||
|
|
||||||
BOOST_FOREACH(CNode* pnode, vNodesCopy)
|
BOOST_FOREACH(CNode* pnode, vNodesCopy)
|
||||||
{
|
{
|
||||||
if (pnode->fDisconnect)
|
if (pnode->fDisconnect)
|
||||||
|
|||||||
Reference in New Issue
Block a user