Bug 1833

Summary: The corresponding endpoint is not deallocated when a UDP socket is closed.
Product: ns-3 Reporter: Tom Goff <tgoff>
Component: internetAssignee: George Riley <riley>
Status: NEW ---    
Severity: normal CC: ns-bugs, tommaso.pecorella
Priority: P5    
Version: pre-release   
Hardware: PC   
OS: All   
Attachments: possible fix
possible fix

Description Tom Goff 2014-01-12 21:18:51 EST
Created attachment 1759 [details]
possible fix

The attached patch is based on the TCP socket implementation.
Comment 1 Tom Goff 2014-01-19 23:39:28 EST
Created attachment 1765 [details]
possible fix

Updated patch to align with commit 10575.
Comment 2 Tommaso Pecorella 2014-01-20 03:26:24 EST
Hi Tom,

I think we mixed the bugs here.

I don't agree on deallocating the endpoints on ShutdownSend (the socket could be still in use to receive), but I do agree on a part I forgot in bug #1739 fix: deleting the socket from UdpL4Protocol.

As a consequence, I'd keep from the obsoleted patch these lines:
+      std::vector<Ptr<UdpSocketImpl> >::iterator it
+        = std::find (m_udp->m_sockets.begin (), m_udp->m_sockets.end (), this);
+      if (it != m_udp->m_sockets.end ())
+        {
+          m_udp->m_sockets.erase (it);
+        }

and 

+      std::vector<Ptr<UdpSocketImpl> >::iterator it
+        = std::find (m_udp->m_sockets.begin (), m_udp->m_sockets.end (), this);
+      if (it != m_udp->m_sockets.end ())
+        {
+          m_udp->m_sockets.erase (it);
+        }

in UdpSocketImpl::DeallocateEndPoint ()

Cheers,

T.
Comment 3 Tom Goff 2014-01-20 12:42:01 EST
> I don't agree on deallocating the endpoints on ShutdownSend (the socket
> could be still in use to receive), but I do agree on a part I forgot in bug
> #1739 fix: deleting the socket from UdpL4Protocol.

Tommaso,

You're correct.  Please disregard the second patch, I somehow mixed
things up when merging.

Thanks for looking at this.

  Tom