HomePhabricator

net: check for invalid socket earlier and get the bind address earlier in…

Description

net: check for invalid socket earlier and get the bind address earlier in CConnman::AcceptConnection()

Summary:

net: check for invalid socket earlier in CConnman::AcceptConnection()

This check is related to an accept() failure. So do the check earlier,
closer to the accept() call.

This will allow to isolate the accept()-specific code at the beginning
of CConnman::AcceptConnection() and reuse the code that follows it.

https://github.com/bitcoin/bitcoin/pull/20685/commits/25605895afe84b1765dd9da9240af22f99489df7

net: get the bind address earlier in CConnman::AcceptConnection()

Call GetBindAddress() earlier in CConnman::AcceptConnection(). That
is specific to the TCP protocol and makes the code below it reusable for
other protocols, if the caller provides addr_bind, retrieved by other
means.

https://github.com/bitcoin/bitcoin/pull/20685/commits/1f75a653dd3b24ba2e4383bf951a6e5a3d5ccbcf

This is a backport of core#20685 [4&5/20]

Depends on D11013

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

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

Details

Provenance
Vasil Dimov <vd@FreeBSD.org>Authored on Nov 24 2020, 11:15
PiRKCommitted on Feb 10 2022, 09:12
PiRKPushed on Feb 10 2022, 09:12
Reviewer
Restricted Project
Differential Revision
D11014: net: check for invalid socket earlier and get the bind address earlier in CConnman::AcceptConnection()
Parents
rABCc577087f7627: util: fix ReadBinaryFile() and WriteBinaryFile() return status
Branches
Unknown
Tags
Unknown