# HG changeset patch # User Fabian Mauchle # Date 1258639037 -3600 # Node ID 564ce4dc24d5f7b8cd2312c27b2e54249f32f34d # Parent 2abe024e7099d8dc848d00f738af7b21f4e0b815 Tcp bug: Listening socket closes on RST diff -r 2abe024e7099 -r 564ce4dc24d5 src/internet-stack/tcp-socket-impl.cc --- a/src/internet-stack/tcp-socket-impl.cc Wed Oct 21 17:19:03 2009 -0700 +++ b/src/internet-stack/tcp-socket-impl.cc Thu Nov 19 14:57:17 2009 +0100 @@ -657,16 +657,6 @@ TcpHeader tcpHeader; packet->RemoveHeader (tcpHeader); - if (tcpHeader.GetFlags () & TcpHeader::RST) - { // Got an RST, just shut everything down - NotifyErrorClose(); - CancelAllTimers(); - m_endPoint->SetDestroyCallback(MakeNullCallback()); - m_tcp->DeAllocate (m_endPoint); - m_endPoint = 0; - return; - } - if (tcpHeader.GetFlags () & TcpHeader::ACK) { Time m = m_rtt->AckSeq (tcpHeader.GetAckNumber () ); @@ -702,13 +692,7 @@ SA stateAction = SimulationSingleton::Get ()->Lookup (m_state,e); NS_LOG_LOGIC ("TcpSocketImpl::ProcessEvent stateAction " << stateAction.action); // debug - if (stateAction.action == RST_TX) - { - NS_LOG_LOGIC ("TcpSocketImpl " << this << " sending RST from state " - << saveState << " event " << e); - SendRST(); - return NO_ACT; - } + bool needCloseNotify = (stateAction.state == CLOSED && m_state != CLOSED && e != TIMEOUT); m_state = stateAction.state; @@ -905,6 +889,12 @@ switch (a) { + case RST_TX: + { + NS_LOG_LOGIC ("TcpSocketImpl " << this << " Action RST_TX"); + SendRST(); + return NO_ACT; + } case ACK_TX: NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action ACK_TX"); if(tcpHeader.GetFlags() & TcpHeader::FIN)