bug 1767: make UDP sockets return error when binding to address already in use
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user