bug 1767: make UDP sockets return error when binding to address already in use

This commit is contained in:
Tom Goff
2013-12-13 22:50:35 -08:00
parent 69091e3dbe
commit 9852907d33

View File

@@ -247,6 +247,11 @@ UdpSocketImpl::Bind (const Address &address)
{
m_endPoint = m_udp->Allocate (ipv4, port);
}
if (0 == m_endPoint)
{
m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL;
return -1;
}
}
else if (Inet6SocketAddress::IsMatchingType (address))
{
@@ -269,6 +274,11 @@ UdpSocketImpl::Bind (const Address &address)
{
m_endPoint6 = m_udp->Allocate6 (ipv6, port);
}
if (0 == m_endPoint6)
{
m_errno = port ? ERROR_ADDRINUSE : ERROR_ADDRNOTAVAIL;
return -1;
}
}
else
{