Bug 1739 - The endpoint is not deallocated for UDP sockets

This commit is contained in:
Juan C. Granda
2014-01-15 23:35:55 +01:00
parent 9ce6ffeb61
commit 123caf7cf3
4 changed files with 27 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ New user-visible features
Bugs fixed
----------
- Bug 1739 - The endpoint is not deallocated for UDP sockets
- Bug 1786 - os << int64x64_t prints un-normalized fractional values
- Bug 1821 - Setting an interface to Down state will cause various asserts in IPv6
- Bug 1837 - AODV crashes when using multiple interfaces

View File

@@ -341,7 +341,7 @@ protected:
void Destroy6 (void);
/**
* \brief Deallocate m_endPoint
* \brief Deallocate m_endPoint and m_endPoint6
*/
void DeallocateEndPoint (void);

View File

@@ -180,6 +180,25 @@ UdpSocketImpl::Destroy6 (void)
m_endPoint6 = 0;
}
/* Deallocate the end point and cancel all the timers */
void
UdpSocketImpl::DeallocateEndPoint (void)
{
if (m_endPoint != 0)
{
m_endPoint->SetDestroyCallback (MakeNullCallback<void> ());
m_udp->DeAllocate (m_endPoint);
m_endPoint = 0;
}
if (m_endPoint6 != 0)
{
m_endPoint6->SetDestroyCallback (MakeNullCallback<void> ());
m_udp->DeAllocate (m_endPoint6);
m_endPoint6 = 0;
}
}
int
UdpSocketImpl::FinishBind (void)
{
@@ -318,6 +337,7 @@ UdpSocketImpl::Close (void)
}
m_shutdownRecv = true;
m_shutdownSend = true;
DeallocateEndPoint ();
return 0;
}

View File

@@ -158,6 +158,11 @@ private:
*/
void Destroy6 (void);
/**
* \brief Deallocate m_endPoint and m_endPoint6
*/
void DeallocateEndPoint (void);
/**
* \brief Send a packet
* \param p packet