Bug 1164 - IPV4 TCP Bind an already used port failed but without setting errno

This commit is contained in:
John Abraham
2011-08-17 11:39:16 -04:00
parent 4c83523c7e
commit adc76894a1
2 changed files with 11 additions and 0 deletions
+10
View File
@@ -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);
+1
View File
@@ -82,6 +82,7 @@ public:
ERROR_NOROUTETOHOST,
ERROR_NODEV,
ERROR_ADDRNOTAVAIL,
ERROR_ADDRINUSE,
SOCKET_ERRNO_LAST
};