Bug 1164 - IPV4 TCP Bind an already used port failed but without setting errno
This commit is contained in:
@@ -242,6 +242,11 @@ TcpSocketBase::Bind (const Address &address)
|
||||
else if (ipv4 == Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (port);
|
||||
if (0 == m_endPoint)
|
||||
{
|
||||
m_errno = ERROR_ADDRINUSE;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port == 0)
|
||||
{
|
||||
@@ -250,6 +255,11 @@ TcpSocketBase::Bind (const Address &address)
|
||||
else if (ipv4 != Ipv4Address::GetAny () && port != 0)
|
||||
{
|
||||
m_endPoint = m_tcp->Allocate (ipv4, port);
|
||||
if (0 == m_endPoint)
|
||||
{
|
||||
m_errno = ERROR_ADDRINUSE;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
NS_LOG_LOGIC ("TcpSocketBase " << this << " got an endpoint: " << m_endPoint);
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ public:
|
||||
ERROR_NOROUTETOHOST,
|
||||
ERROR_NODEV,
|
||||
ERROR_ADDRNOTAVAIL,
|
||||
ERROR_ADDRINUSE,
|
||||
SOCKET_ERRNO_LAST
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user