HomePhabricator

net: Split socket create/connect

Description

net: Split socket create/connect

Summary:

  • net: split socket creation out of connection

Also, check for the correct error during socket creation

  • net: Move IsSelectableSocket check into socket creation

We use select in ConnectSocketDirectly, so this check needs to happen before
that.

IsSelectableSocket will not be relevant after upcoming changes to remove select.

  • net: use CreateSocket for binds
  • net: pass socket closing responsibility up to caller for outgoing connections

This allows const references to be passed around, making it clear where the
socket may and may not be invalidated.

This is a backport of Core PR11363

Depends on D1870, D1871 and D1873

Test Plan:

make check

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Subscribers: teamcity

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

Details

Provenance
Cory Fields <cory-nospam-@coryfields.com>Authored on Sep 18 2017, 22:45
deadalnixCommitted on Oct 5 2018, 09:29
deadalnixPushed on Oct 5 2018, 09:45
Reviewer
Restricted Project
Differential Revision
D1874: net: Split socket create/connect
Parents
rSTAGING4360caaa6126: [net] De-duplicate connection eviction logic
Branches
Unknown
Tags
Unknown

Event Timeline