Bugzilla – Bug 1829
Multiple TCP socket entries
Last modified: 2014-04-22 14:44:12 UTC
Initial discussion on the mailing list about some strange tracing behaviour of TCP sockets here https://groups.google.com/d/msg/ns-3-users/imAdVyvTwC8/uQR0cq46iFUJ A TCP socket is added twice in the m_socket list, once on the creation and another when the Bind() is called for a server and at the CompleteFork() for the client. Quoting Tomasso here "this is stupid." There are actually two bugs Bug 1: sockets are duplicate in the sender (i.e., who's using Connect). Bug 2: socket is duplicate **and not copied** in the receiver (who's using Listen). Solution 1: do not add the socket to the socket list as soon as it's created. Solution 2: do a check before adding a socket to the list (if it's already in the list, don't add it again).
Created attachment 1756 [details] patch Actually I was wrong (partially). The socket is copied in the right way when there's fork. Still, the sockets are duplicated if one uses the Tcp "way": Ptr<SocketFactory> sockFactory0 = node0->GetObject<TcpSocketFactory> (); Ptr<Socket> server = sockFactory0->CreateSocket (); The proposed patch fixes this. T.
10697:323f8bb2ec61 Thanks for bug fix!