diff options
author | Matthew Zipkin <pinheadmz@gmail.com> | 2023-05-26 12:26:43 -0400 |
---|---|---|
committer | Matthew Zipkin <pinheadmz@gmail.com> | 2024-03-01 13:13:07 -0500 |
commit | bae86c8d318d06818aa75a9ebe3db864197f0bc6 (patch) | |
tree | 893a4fde71f37fcfab090b216a8f097ce9308fb8 /src/netbase.h | |
parent | adb3a3e51de205cc69b1a58647c65c04fa6c6362 (diff) | |
download | bitcoin-bae86c8d318d06818aa75a9ebe3db864197f0bc6.tar.xz |
netbase: refactor CreateSock() to accept sa_family_t
Also implement CService::GetSAFamily() to provide sa_family_t
Diffstat (limited to 'src/netbase.h')
-rw-r--r-- | src/netbase.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/netbase.h b/src/netbase.h index 1bd95ba0d9..6f2d86f153 100644 --- a/src/netbase.h +++ b/src/netbase.h @@ -229,16 +229,16 @@ CService LookupNumeric(const std::string& name, uint16_t portDefault = 0, DNSLoo CSubNet LookupSubNet(const std::string& subnet_str); /** - * Create a TCP socket in the given address family. - * @param[in] address_family The socket is created in the same address family as this address. + * Create a socket in the given address family. + * @param[in] address_family to use for the socket. * @return pointer to the created Sock object or unique_ptr that owns nothing in case of failure */ -std::unique_ptr<Sock> CreateSockTCP(const CService& address_family); +std::unique_ptr<Sock> CreateSockOS(sa_family_t address_family); /** - * Socket factory. Defaults to `CreateSockTCP()`, but can be overridden by unit tests. + * Socket factory. Defaults to `CreateSockOS()`, but can be overridden by unit tests. */ -extern std::function<std::unique_ptr<Sock>(const CService&)> CreateSock; +extern std::function<std::unique_ptr<Sock>(const sa_family_t&)> CreateSock; /** * Try to connect to the specified service on the specified socket. |