networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp
changeset 51 78fceed50f62
parent 25 d15a50675083
child 66 34ec136802c5
--- a/networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp	Tue Jul 06 16:04:34 2010 +0300
+++ b/networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp	Wed Aug 18 11:18:20 2010 +0300
@@ -1771,7 +1771,8 @@
 		if (iFlags.iRetransmitPending)
 			{
 			iFlags.iRetransmitPending = EFalse;
-			RetransmitSegments();
+			if(RetransmitSegments())
+				return;
 			}
 
 		if (iFlags.iTransmitPending)
@@ -2375,7 +2376,12 @@
 		++iBackoff;
 		if (iRTO < Protocol()->MaxRTO())  // Avoid RTO overflow
 			ResetRTO();
-
+		
+		if(DetachIfDead())
+			{
+			Expire();
+			return;
+			}
 		//
 		// Timeout?
 		//
@@ -2490,7 +2496,7 @@
 //  - directly from RetransmitTimeout()
 //  - from CanSend(), in which case this is a delayed retransmission timeout
 //
-void CProviderTCP6::RetransmitSegments()
+TBool CProviderTCP6::RetransmitSegments()
 	{
 	ASSERT(iRetransTimer);
 
@@ -2506,7 +2512,7 @@
 		{
 		LOG(Log::Printf(_L("\ttcp SAP[%u] RetransmitSegments(): Flow pending"), (TInt)this));
 		ReSchedRetransmit();
-		return;
+		return EFalse;
 		}
 
 	//
@@ -2564,14 +2570,14 @@
 			// the receiver suddenly shrinks its window. The current solution covers
 			// both cases.
 			//
-			return;
+			return EFalse;
 			}
 
 		//
 		// This is a retransmit timout. Do we have anything to do?
 		//
 		if (!unacked)
-			return;
+			return EFalse;
 
 		LOG(if (iFlags.iFastRetransMode) Log::Printf(_L("\ttcp SAP[%u] RetransmitSegments(): Leaving FAST RETRANS mode"), (TInt)this));
 		iFlags.iFastRetransMode = EFalse;
@@ -2644,7 +2650,7 @@
 		// If the server doesn't respond because of broken NAT/FW or other, don't keep interface up.
 		if (InState(ETcpFinWait1|ETcpClosing|ETcpLastAck))
 			DetachIfDead();
-		return;
+		return EFalse;
 		}
 
 	//
@@ -2654,14 +2660,14 @@
 		{
 		// Retransmit SYN
 		SendSegment(KTcpCtlSYN, iSND.UNA);
-		return;
+		return EFalse;
 		}
 
 	if (InState(ETcpSynReceived))
 		{
 		// Retransmit SYN,ACK
 		SendSegment(KTcpCtlSYN|KTcpCtlACK, iSND.UNA);
-		return;
+		return EFalse;
 		}
 
 	if (InState(ETcpFinWait1|ETcpClosing|ETcpLastAck))
@@ -2671,18 +2677,22 @@
 	    //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
-		if(continue_send == EFalse)
+		if(DetachIfDead()== EFalse)
+			{
 			SendSegment(KTcpCtlFIN|KTcpCtlACK, iSND.UNA);
-		return;
+			return EFalse;
+			}
 		}
 
 	LOG(Log::Printf(_L("\ttcp SAP[%u] RetransmitSegments(): Retransmitter stopping"), (TInt)this));
 	if (!iSockFlags.iAttached)
+		{
 		Expire();
-	return;
+		return ETrue;
+		}
+	return EFalse;
 	}