[Ns-bugs] [Bug 311] Tcp socket close returns -1 but does not set errno.
bugzilla-daemon@nsnam-www.ece.gatech.edu
bugzilla-daemon at nsnam-www.ece.gatech.edu
Wed Sep 17 12:34:52 PDT 2008
http://www.nsnam.org/bugzilla/show_bug.cgi?id=311
------- Comment #2 from raj.b at gatech.edu 2008-09-17 15:34 -------
It seems the purpose of this check was to prevent a double close, BUT it
apparently is superfluous in any case, because the state machine has the
following entry in it:
aT[CLOSED][APP_CLOSE] = SA (CLOSED, NO_ACT);
Since we call ProcessEvent(APP_CLOSE) in this code, in the case of already
being in the CLOSED state, nothing would happen in terms of state change or
action in response to closing the socket. As such, deleting the check would
cause a double close to silently succeed, and return 0. Really, this is what
should have been done, because the processing of the m_state variable shouldn't
explicitly be done in this code since it is handled by the ProcessEvent/Action
methods.
diff -r 6105fe16df43 src/internet-stack/tcp-socket-impl.cc
--- a/src/internet-stack/tcp-socket-impl.cc Tue Sep 16 11:55:52 2008 -0700
+++ b/src/internet-stack/tcp-socket-impl.cc Wed Sep 17 15:33:07 2008 -0400
@@ -296,10 +296,6 @@
TcpSocketImpl::Close (void)
{
NS_LOG_FUNCTION_NOARGS ();
- if (m_state == CLOSED)
- {
- return -1;
- }
if (m_pendingData && m_pendingData->Size() != 0)
{ // App close with pending data must wait until all data transmitted
m_closeOnEmpty = true;
--
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Ns-bugs
mailing list