mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-09 23:27:23 +02:00
Make GetBindAddress() callable from outside net.cpp
The function logic is moved-only from net.cpp to netbase.cpp and redeclared (as non-static) in netbase.h
This commit is contained in:
@@ -947,3 +947,16 @@ CService MaybeFlipIPv6toCJDNS(const CService& service)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
CService GetBindAddress(const Sock& sock)
|
||||
{
|
||||
CService addr_bind;
|
||||
struct sockaddr_storage sockaddr_bind;
|
||||
socklen_t sockaddr_bind_len = sizeof(sockaddr_bind);
|
||||
if (!sock.GetSockName((struct sockaddr*)&sockaddr_bind, &sockaddr_bind_len)) {
|
||||
addr_bind.SetSockAddr((const struct sockaddr*)&sockaddr_bind, sockaddr_bind_len);
|
||||
} else {
|
||||
LogWarning("getsockname failed\n");
|
||||
}
|
||||
return addr_bind;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user