Page MenuHomePhabricator

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

Authored by PiRK on Wed, Nov 13, 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