networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp
changeset 18 39bb7c3571e9
parent 0 af10295192d8
child 23 23b59305592d
child 25 d15a50675083
child 37 052078dda061
equal deleted inserted replaced
14:b33c3d136b7e 18:39bb7c3571e9
  2578 		}
  2578 		}
  2579 
  2579 
  2580 	if (InState(ETcpFinWait1|ETcpClosing|ETcpLastAck))
  2580 	if (InState(ETcpFinWait1|ETcpClosing|ETcpLastAck))
  2581 		{
  2581 		{
  2582 		// If the server doesn't respond because of broken NAT/FW or other, don't keep interface up.
  2582 		// If the server doesn't respond because of broken NAT/FW or other, don't keep interface up.
  2583 		DetachIfDead();
  2583 	
       
  2584 	    //TSW error:JHAA-82JBNG -- FIN retransmission 
       
  2585 		//Depending on the function return value the decision to
       
  2586 	    //retransmitt FIN is decided
       
  2587 
       
  2588 		TBool continue_send = DetachIfDead();
  2584 		// Retransmit FIN
  2589 		// Retransmit FIN
  2585 		SendSegment(KTcpCtlFIN|KTcpCtlACK, iSND.UNA);
  2590 		if(continue_send == EFalse)
       
  2591 			SendSegment(KTcpCtlFIN|KTcpCtlACK, iSND.UNA);
  2586 		return;
  2592 		return;
  2587 		}
  2593 		}
  2588 
  2594 
  2589 	LOG(Log::Printf(_L("\ttcp SAP[%u] RetransmitSegments(): Retransmitter stopping"), (TInt)this));
  2595 	LOG(Log::Printf(_L("\ttcp SAP[%u] RetransmitSegments(): Retransmitter stopping"), (TInt)this));
  2590 	if (!iSockFlags.iAttached)
  2596 	if (!iSockFlags.iAttached)
  2751 	}
  2757 	}
  2752 
  2758 
  2753 //
  2759 //
  2754 // Detach the SAP if the application has closed and we seem to keep resending stuff.
  2760 // Detach the SAP if the application has closed and we seem to keep resending stuff.
  2755 //
  2761 //
  2756 void CProviderTCP6::DetachIfDead()
  2762 TBool CProviderTCP6::DetachIfDead()
  2757 	{
  2763 	{
  2758 	if (iSockFlags.iRecvClose && iSockFlags.iSendClose && Protocol()->FinPersistency()
  2764 	if (iSockFlags.iRecvClose && iSockFlags.iSendClose && Protocol()->FinPersistency()
  2759 		&& iBackoff >= Protocol()->FinPersistency())
  2765 		&& iBackoff >= Protocol()->FinPersistency())
  2760 		{
  2766 		{
  2761 		LOG(Log::Printf(_L("\ttcp SAP[%u] Peer looks dead while %d bytes unacked data. Detach!"), 
  2767 		LOG(Log::Printf(_L("\ttcp SAP[%u] Peer looks dead while %d bytes unacked data. Detach!"), 
  2762 			(TInt)this, Min(iSND.NXT - iSND.UNA, iSockOutQLen)));
  2768 			(TInt)this, Min(iSND.NXT - iSND.UNA, iSockOutQLen)));
  2763 		DetachFromInterface();
  2769 		DetachFromInterface();
  2764 		}
  2770 		
       
  2771 		//TSW error:JHAA-82JBNG -- FIN retransmission 
       
  2772 		//The FinPersistency value read from the tcpip.ini file determines
       
  2773 		//the number of times FIN should be retransmitted
       
  2774 		//Once we reach the maximum value the DetachFromInterface() is called
       
  2775 		//and we return ETrue. 
       
  2776 		return ETrue;
       
  2777 		}
       
  2778 	return EFalse;
  2765 	}
  2779 	}
  2766 
  2780 
  2767 void CProviderTCP6::DetachFromInterface()
  2781 void CProviderTCP6::DetachFromInterface()
  2768 /**
  2782 /**
  2769 Removes this SAP from the user socket count and interface flow count.
  2783 Removes this SAP from the user socket count and interface flow count.