tcp: (fixes #2565) Notify normal close when entering TIME_WAIT

This commit is contained in:
Tom Henderson
2017-06-03 15:03:28 -07:00
parent be325774b3
commit fb258a0f49

View File

@@ -3382,6 +3382,14 @@ TcpSocketBase::TimeWait ()
NS_LOG_DEBUG (TcpStateName[m_state] << " -> TIME_WAIT");
m_state = TIME_WAIT;
CancelAllTimers ();
if (!m_closeNotified)
{
// Technically the connection is not fully closed, but we notify now
// because an implementation (real socket) would behave as if closed.
// Notify normal close when entering TIME_WAIT or leaving LAST_ACK.
NotifyNormalClose ();
m_closeNotified = true;
}
// Move from TIME_WAIT to CLOSED after 2*MSL. Max segment lifetime is 2 min
// according to RFC793, p.28
m_timewaitEvent = Simulator::Schedule (Seconds (2 * m_msl),