--- a/src/internet/model/tcp-socket-base.cc Wed Oct 29 18:16:16 2014 -0700
+++ b/src/internet/model/tcp-socket-base.cc Fri Oct 31 13:36:46 2014 -0700
@@ -812,20 +812,17 @@
void
TcpSocketBase::CloseAndNotify (void)
{
- Ptr<TcpSocketBase> l_ptr = (m_state == TIME_WAIT ? this : 0);
-
NS_LOG_FUNCTION (this);
if (!m_closeNotified)
{
NotifyNormalClose ();
+ m_closeNotified = true;
}
+ NS_LOG_INFO (TcpStateName[m_state] << " -> CLOSED");
+ m_state = CLOSED;
DeallocateEndPoint ();
- m_closeNotified = true;
- NS_LOG_INFO (TcpStateName[m_state] << " -> CLOSED");
- CancelAllTimers ();
- m_state = CLOSED;
}
@@ -1749,6 +1746,7 @@
{
if (m_endPoint != 0)
{
+ CancelAllTimers ();
m_endPoint->SetDestroyCallback (MakeNullCallback<void> ());
m_tcp->DeAllocate (m_endPoint);
m_endPoint = 0;
@@ -1758,10 +1756,10 @@
{
m_tcp->m_sockets.erase (it);
}
+ }
+ else if (m_endPoint6 != 0)
+ {
CancelAllTimers ();
- }
- if (m_endPoint6 != 0)
- {
m_endPoint6->SetDestroyCallback (MakeNullCallback<void> ());
m_tcp->DeAllocate (m_endPoint6);
m_endPoint6 = 0;
@@ -1771,7 +1769,6 @@
{
m_tcp->m_sockets.erase (it);
}
- CancelAllTimers ();
}
}