HomePhabricator

[net/refactor] Simplify multiple-connection checks

Description

[net/refactor] Simplify multiple-connection checks

Summary:

Extract logic that check multiple connection types into interface
functions & structure as switch statements. This makes it very clear
what touch points are for accessing `m_conn_type` & using the switch
statements enables the compiler to warn if a new connection type is
introduced but not handled for these cases.

Partial backport (17/19) of core PR19316:
https://github.com/bitcoin/bitcoin/pull/19316/commits/2f2e13b6c2c8741ca9d825eaaef736ede484bc85

Depends on D8726.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

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

Details

Provenance
Amiti Uttarwar <amiti@uttarwar.org>Authored on Jul 20 2020, 21:24
FabienCommitted on Dec 21 2020, 15:57
FabienPushed on Dec 21 2020, 15:59
Reviewer
Restricted Project
Differential Revision
D8727: [net/refactor] Simplify multiple-connection checks
Parents
rABC5c39c9d8f014: [net/refactor] Rework ThreadOpenConnections logic
Branches
Unknown
Tags
Unknown