Page MenuHomePhabricator

net: use Sock::WaitMany() instead of CConnman::SocketEvents()
ClosedPublic

Authored by PiRK on Nov 13 2024, 17:52.

Details

Summary

Rename GenerateSelectSet() to GenerateWaitSockets() and adapt it to
generate a wait data suitable for Sock::WaitMany(). Then call it from
CConnman::SocketHandler() and feed the generated data to
Sock::WaitMany().

This way CConnman::SocketHandler() can be unit tested because
Sock::WaitMany() is mockable, so the usage of real sockets can be
avoided.

Resolves https://github.com/bitcoin/bitcoin/issues/21744

This concludes backport of core#24356
https://github.com/bitcoin/bitcoin/pull/24356/commits/6e68ccbefea6509c61fc4405a391a517c6057bb0

Depends on D17133

Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.Nov 13 2024, 17:52
This revision is now accepted and ready to land.Nov 14 2024, 09:04