|
657 |
TcpHeader tcpHeader; |
657 |
TcpHeader tcpHeader; |
658 |
packet->RemoveHeader (tcpHeader); |
658 |
packet->RemoveHeader (tcpHeader); |
659 |
|
659 |
|
660 |
if (tcpHeader.GetFlags () & TcpHeader::RST) |
|
|
661 |
{ // Got an RST, just shut everything down |
662 |
NotifyErrorClose(); |
663 |
CancelAllTimers(); |
664 |
m_endPoint->SetDestroyCallback(MakeNullCallback<void>()); |
665 |
m_tcp->DeAllocate (m_endPoint); |
666 |
m_endPoint = 0; |
667 |
return; |
668 |
} |
669 |
|
670 |
if (tcpHeader.GetFlags () & TcpHeader::ACK) |
660 |
if (tcpHeader.GetFlags () & TcpHeader::ACK) |
671 |
{ |
661 |
{ |
672 |
Time m = m_rtt->AckSeq (tcpHeader.GetAckNumber () ); |
662 |
Time m = m_rtt->AckSeq (tcpHeader.GetAckNumber () ); |
|
702 |
SA stateAction = SimulationSingleton<TcpStateMachine>::Get ()->Lookup (m_state,e); |
692 |
SA stateAction = SimulationSingleton<TcpStateMachine>::Get ()->Lookup (m_state,e); |
703 |
NS_LOG_LOGIC ("TcpSocketImpl::ProcessEvent stateAction " << stateAction.action); |
693 |
NS_LOG_LOGIC ("TcpSocketImpl::ProcessEvent stateAction " << stateAction.action); |
704 |
// debug |
694 |
// debug |
705 |
if (stateAction.action == RST_TX) |
695 |
|
706 |
{ |
|
|
707 |
NS_LOG_LOGIC ("TcpSocketImpl " << this << " sending RST from state " |
708 |
<< saveState << " event " << e); |
709 |
SendRST(); |
710 |
return NO_ACT; |
711 |
} |
712 |
bool needCloseNotify = (stateAction.state == CLOSED && m_state != CLOSED |
696 |
bool needCloseNotify = (stateAction.state == CLOSED && m_state != CLOSED |
713 |
&& e != TIMEOUT); |
697 |
&& e != TIMEOUT); |
714 |
m_state = stateAction.state; |
698 |
m_state = stateAction.state; |
|
905 |
|
889 |
|
906 |
switch (a) |
890 |
switch (a) |
907 |
{ |
891 |
{ |
|
|
892 |
case RST_TX: |
893 |
{ |
894 |
NS_LOG_LOGIC ("TcpSocketImpl " << this << " Action RST_TX"); |
895 |
SendRST(); |
896 |
return NO_ACT; |
897 |
} |
908 |
case ACK_TX: |
898 |
case ACK_TX: |
909 |
NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action ACK_TX"); |
899 |
NS_LOG_LOGIC ("TcpSocketImpl " << this <<" Action ACK_TX"); |
910 |
if(tcpHeader.GetFlags() & TcpHeader::FIN) |
900 |
if(tcpHeader.GetFlags() & TcpHeader::FIN) |