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,13 +78,17 @@ FUZZ_TARGET(process_messages, .init = initialize_process_messages)
|
||||||
|
|
||||||
connman.FlushSendBuffer(random_node);
|
connman.FlushSendBuffer(random_node);
|
||||||
(void)connman.ReceiveMsgFrom(random_node, std::move(net_msg));
|
(void)connman.ReceiveMsgFrom(random_node, std::move(net_msg));
|
||||||
random_node.fPauseSend = false;
|
|
||||||
|
|
||||||
try {
|
bool more_work{true};
|
||||||
connman.ProcessMessagesOnce(random_node);
|
while (more_work) { // Ensure that every message is eventually processed in some way or another
|
||||||
} catch (const std::ios_base::failure&) {
|
random_node.fPauseSend = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
more_work = connman.ProcessMessagesOnce(random_node);
|
||||||
|
} catch (const std::ios_base::failure&) {
|
||||||
|
}
|
||||||
|
g_setup->m_node.peerman->SendMessages(&random_node);
|
||||||
}
|
}
|
||||||
g_setup->m_node.peerman->SendMessages(&random_node);
|
|
||||||
}
|
}
|
||||||
SyncWithValidationInterfaceQueue();
|
SyncWithValidationInterfaceQueue();
|
||||||
g_setup->m_node.connman->StopNodes();
|
g_setup->m_node.connman->StopNodes();
|
||||||
|
|
|
@ -70,7 +70,10 @@ struct ConnmanTestMsg : public CConnman {
|
||||||
bool relay_txs)
|
bool relay_txs)
|
||||||
EXCLUSIVE_LOCKS_REQUIRED(NetEventsInterface::g_msgproc_mutex);
|
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;
|
void NodeReceiveMsgBytes(CNode& node, Span<const uint8_t> msg_bytes, bool& complete) const;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue