mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
net: don't check if the socket is valid in GetBindAddress()
The socket is always valid (the underlying file descriptor is not `INVALID_SOCKET`) when `GetBindAddress()` is called.
This commit is contained in:
parent
5ac1a51ee5
commit
aeac68d036
1 changed files with 4 additions and 6 deletions
|
@ -427,13 +427,11 @@ static CAddress GetBindAddress(const Sock& sock)
|
||||||
CAddress addr_bind;
|
CAddress addr_bind;
|
||||||
struct sockaddr_storage sockaddr_bind;
|
struct sockaddr_storage sockaddr_bind;
|
||||||
socklen_t sockaddr_bind_len = sizeof(sockaddr_bind);
|
socklen_t sockaddr_bind_len = sizeof(sockaddr_bind);
|
||||||
if (sock.Get() != INVALID_SOCKET) {
|
|
||||||
if (!sock.GetSockName((struct sockaddr*)&sockaddr_bind, &sockaddr_bind_len)) {
|
if (!sock.GetSockName((struct sockaddr*)&sockaddr_bind, &sockaddr_bind_len)) {
|
||||||
addr_bind.SetSockAddr((const struct sockaddr*)&sockaddr_bind);
|
addr_bind.SetSockAddr((const struct sockaddr*)&sockaddr_bind);
|
||||||
} else {
|
} else {
|
||||||
LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "getsockname failed\n");
|
LogPrintLevel(BCLog::NET, BCLog::Level::Warning, "getsockname failed\n");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return addr_bind;
|
return addr_bind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue