HomePhabricator

net: use Sock in CNode

Description

net: use Sock in CNode

Summary:
Change CNode to use a pointer to Sock instead of a bare SOCKET.
This will help mocking / testing / fuzzing more code.

Rename CNode::cs_hSocket to CNode::m_sock_mutex

This is a partial backport of core#23604
https://github.com/bitcoin/bitcoin/pull/23604/commits/c5dd72e146dd8fa77d29c8689a42322a4d1ec780
https://github.com/bitcoin/bitcoin/pull/23604/commits/c41a1162ac4da437c5d755e8fe2bf636bed22b0f
https://github.com/bitcoin/bitcoin/pull/23604/commits/b68349164827f14c472201cad54c4e19a3321261

We also need to split the FuzzedSock interface and implementation (https://github.com/bitcoin/bitcoin/pull/21630/commits/29ae1c13a59187119f5b2a38b54dbbec936d8f87) to "make move FuzzedSock earlier in src/test/fuzz/util.h" work.

Depends on D17130

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
Vasil Dimov <vd@FreeBSD.org>Authored on Apr 23 2021, 13:15
PiRKCommitted on Nov 18 2024, 06:42
PiRKPushed on Nov 18 2024, 06:42
Reviewer
Restricted Project
Differential Revision
D17131: net: use Sock in CNode
Parents
rABC7e5ca9440c2f: refactor: wrap accept() and extend usage of Sock
Branches
Unknown
Tags
Unknown

Event Timeline