mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 22:18:54 +01:00
netbase: refactor CreateSock() to accept sa_family_t
Also implement CService::GetSAFamily() to provide sa_family_t
This commit is contained in:
@@ -818,6 +818,19 @@ bool CService::SetSockAddr(const struct sockaddr *paddr)
|
||||
}
|
||||
}
|
||||
|
||||
sa_family_t CService::GetSAFamily() const
|
||||
{
|
||||
switch (m_net) {
|
||||
case NET_IPV4:
|
||||
return AF_INET;
|
||||
case NET_IPV6:
|
||||
case NET_CJDNS:
|
||||
return AF_INET6;
|
||||
default:
|
||||
return AF_UNSPEC;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t CService::GetPort() const
|
||||
{
|
||||
return port;
|
||||
|
||||
Reference in New Issue
Block a user