networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp
branchRCL_3
changeset 12 e9cc36e353d4
parent 0 af10295192d8
child 23 23b59305592d
child 25 d15a50675083
child 37 052078dda061
--- a/networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp	Mon Mar 15 12:46:10 2010 +0200
+++ b/networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp	Thu Apr 01 00:00:09 2010 +0300
@@ -2580,9 +2580,15 @@
 	if (InState(ETcpFinWait1|ETcpClosing|ETcpLastAck))
 		{
 		// If the server doesn't respond because of broken NAT/FW or other, don't keep interface up.
-		DetachIfDead();
+	
+	    //TSW error:JHAA-82JBNG -- FIN retransmission 
+		//Depending on the function return value the decision to
+	    //retransmitt FIN is decided
+
+		TBool continue_send = DetachIfDead();
 		// Retransmit FIN
-		SendSegment(KTcpCtlFIN|KTcpCtlACK, iSND.UNA);
+		if(continue_send == EFalse)
+			SendSegment(KTcpCtlFIN|KTcpCtlACK, iSND.UNA);
 		return;
 		}
 
@@ -2753,7 +2759,7 @@
 //
 // Detach the SAP if the application has closed and we seem to keep resending stuff.
 //
-void CProviderTCP6::DetachIfDead()
+TBool CProviderTCP6::DetachIfDead()
 	{
 	if (iSockFlags.iRecvClose && iSockFlags.iSendClose && Protocol()->FinPersistency()
 		&& iBackoff >= Protocol()->FinPersistency())
@@ -2761,7 +2767,15 @@
 		LOG(Log::Printf(_L("\ttcp SAP[%u] Peer looks dead while %d bytes unacked data. Detach!"), 
 			(TInt)this, Min(iSND.NXT - iSND.UNA, iSockOutQLen)));
 		DetachFromInterface();
+		
+		//TSW error:JHAA-82JBNG -- FIN retransmission 
+		//The FinPersistency value read from the tcpip.ini file determines
+		//the number of times FIN should be retransmitted
+		//Once we reach the maximum value the DetachFromInterface() is called
+		//and we return ETrue. 
+		return ETrue;
 		}
+	return EFalse;
 	}
 
 void CProviderTCP6::DetachFromInterface()