mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 15:04:44 +01:00
fuzz: p2p: Detect peer deadlocks
This commit is contained in:
parent
6d5790956f
commit
fae1e7e012
2 changed files with 13 additions and 6 deletions
|
@ -78,14 +78,18 @@ FUZZ_TARGET(process_messages, .init = initialize_process_messages)
|
|||
|
||||
connman.FlushSendBuffer(random_node);
|
||||
(void)connman.ReceiveMsgFrom(random_node, std::move(net_msg));
|
||||
|
||||
bool more_work{true};
|
||||
while (more_work) { // Ensure that every message is eventually processed in some way or another
|
||||
random_node.fPauseSend = false;
|
||||
|
||||
try {
|
||||
connman.ProcessMessagesOnce(random_node);
|
||||
more_work = connman.ProcessMessagesOnce(random_node);
|
||||
} catch (const std::ios_base::failure&) {
|
||||
}
|
||||
g_setup->m_node.peerman->SendMessages(&random_node);
|
||||
}
|
||||
}
|
||||
SyncWithValidationInterfaceQueue();
|
||||
g_setup->m_node.connman->StopNodes();
|
||||
}
|
||||
|
|
|
@ -70,7 +70,10 @@ struct ConnmanTestMsg : public CConnman {
|
|||
bool relay_txs)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(NetEventsInterface::g_msgproc_mutex);
|
||||
|
||||
void ProcessMessagesOnce(CNode& node) EXCLUSIVE_LOCKS_REQUIRED(NetEventsInterface::g_msgproc_mutex) { m_msgproc->ProcessMessages(&node, flagInterruptMsgProc); }
|
||||
bool ProcessMessagesOnce(CNode& node) EXCLUSIVE_LOCKS_REQUIRED(NetEventsInterface::g_msgproc_mutex)
|
||||
{
|
||||
return m_msgproc->ProcessMessages(&node, flagInterruptMsgProc);
|
||||
}
|
||||
|
||||
void NodeReceiveMsgBytes(CNode& node, Span<const uint8_t> msg_bytes, bool& complete) const;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue