HomePhabricator

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

Description

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

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

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D17134

Details

Provenance
Vasil Dimov <vd@FreeBSD.org>Authored on May 4 2021, 16:37
PiRKCommitted on Nov 18 2024, 06:42
PiRKPushed on Nov 18 2024, 06:42
Reviewer
Restricted Project
Differential Revision
D17134: net: use Sock::WaitMany() instead of CConnman::SocketEvents()
Parents
rABC9f4a3fa6a70c: net: introduce Sock::WaitMany()
Branches
Unknown
Tags
Unknown