mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
net: introduce Sock::WaitMany()
It allows waiting concurrently on more than one socket. Being a `virtual` `Sock` method it can be overriden by tests. Will be used to replace `CConnman::SocketEvents()`.
This commit is contained in:
@@ -223,6 +223,15 @@ bool FuzzedSock::Wait(std::chrono::milliseconds timeout, Event requested, Event*
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FuzzedSock::WaitMany(std::chrono::milliseconds timeout, EventsPerSock& events_per_sock) const
|
||||
{
|
||||
for (auto& [sock, events] : events_per_sock) {
|
||||
(void)sock;
|
||||
events.occurred = m_fuzzed_data_provider.ConsumeBool() ? events.requested : 0;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FuzzedSock::IsConnected(std::string& errmsg) const
|
||||
{
|
||||
if (m_fuzzed_data_provider.ConsumeBool()) {
|
||||
|
||||
Reference in New Issue
Block a user