networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp
branchRCL_3
changeset 14 23b59305592d
parent 8 e9cc36e353d4
child 17 d566d76acea1
--- a/networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp	Tue May 11 17:38:48 2010 +0300
+++ b/networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp	Tue May 25 14:22:18 2010 +0300
@@ -1102,7 +1102,7 @@
 			// Start linger timer. RSocket::Close() returns when timer
 			// expires or when all data has been succesfully transmitted.
 			//
-			iLingerTimer->Start(iLinger * KOneSecondUs);
+			iLingerTimer->Start(iLinger * KOneSecondInUs);
 			}
 		SchedTransmit();
 
@@ -1700,7 +1700,7 @@
 			{
 			// The heaviest time check only if we are otherwise allowed to send the keepalive.
 			TUint32 time_now = TimeStamp();
-			if (time_now - iLastTriggeredKeepAlive > KTcpKeepAliveTH * KOneSecondUs)
+			if (time_now - iLastTriggeredKeepAlive > KTcpKeepAliveTH * KOneSecondInMs)
 				{
 				iLastTriggeredKeepAlive = time_now;
 				LOG(Log::Printf(_L("\ttcp SAP[%u] CanSend(): Sending a Keep-Alive probe"), (TInt)this));
@@ -2354,7 +2354,7 @@
 	if (!iLastTimeout)
 		iLastTimeout = usec;
 
-	TUint32 distance = (usec - iLastTimeout) / KOneSecondUs;  // seconds
+	TUint32 distance = (usec - iLastTimeout) / KOneSecondInMs;  // seconds
 	TUint32 interval = iBackoff ? Protocol()->KeepAliveRxmt() : Protocol()->KeepAliveIntv();
 
 	if (distance > interval)
@@ -2363,14 +2363,14 @@
 		LOG(Log::Printf(_L("\ttcp SAP[%u] KeepAliveTimeout(): Sending a Keep-Alive probe"), (TInt)this));
 		SendSegment(KTcpCtlACK, iSND.UNA - 1, 0);
 		iBackoff++;
-		iRetransTimer->Restart(Protocol()->KeepAliveRxmt() * KOneSecondUs);
+		iRetransTimer->Restart(Protocol()->KeepAliveRxmt() * KOneSecondInUs);
 		}
 	else
 		{
 		// This branch is entered when the first keepalive has to be issued after an idle period.
 		distance = Protocol()->KeepAliveIntv() - distance;
 		iRetransTimer->Restart((distance > 1800) ?
-			1800 * KOneSecondUs : (distance * KOneSecondUs));
+			1800 * KOneSecondInUs : (distance * KOneSecondInUs));
 		}
 	}
 
@@ -2379,7 +2379,7 @@
 	{
 	ASSERT(iRetransTimer);
 	iRetransTimer->Restart((Protocol()->KeepAliveIntv() > 1800) ?
-		1800 * KOneSecondUs : (Protocol()->KeepAliveIntv() * KOneSecondUs));
+		1800 * KOneSecondInUs : (Protocol()->KeepAliveIntv() * KOneSecondInUs));
 	// Backoff is used for counting unacknowledged keepalive retransmissions during idle periods
 	iBackoff = 0;
 	iLastTimeout = TimeStamp();
@@ -3591,20 +3591,20 @@
 							{
 							// NewReno partial ACK processing.
 
-			  /* From RFC2582:
-			   If this ACK does *not* acknowledge all of the data up to and
-			   including "recover", then this is a partial ACK.  In this case,
-			   retransmit the first unacknowledged segment.  Deflate the
-			   congestion window by the amount of new data acknowledged, then
-			   add back one MSS and send a new segment if permitted by the new
-			   value of cwnd.  This "partial window deflation" attempts to
-			   ensure that, when Fast Recovery eventually ends, approximately
-			   ssthresh amount of data will be outstanding in the network.  Do
-			   not exit the Fast Recovery procedure (i.e., if any duplicate ACKs
-			   subsequently arrive, execute Steps 3 and 4 above).
-
-			   For the first partial ACK that arrives during Fast Recovery, also
-			   reset the retransmit timer.
+						  /* From RFC2582:
+						   If this ACK does *not* acknowledge all of the data up to and
+						   including "recover", then this is a partial ACK.  In this case,
+						   retransmit the first unacknowledged segment.  Deflate the
+						   congestion window by the amount of new data acknowledged, then
+						   add back one MSS and send a new segment if permitted by the new
+						   value of cwnd.  This "partial window deflation" attempts to
+						   ensure that, when Fast Recovery eventually ends, approximately
+						   ssthresh amount of data will be outstanding in the network.  Do
+						   not exit the Fast Recovery procedure (i.e., if any duplicate ACKs
+						   subsequently arrive, execute Steps 3 and 4 above).
+
+						   For the first partial ACK that arrives during Fast Recovery, also
+						   reset the retransmit timer.
 							*/
 
 							iCwnd -= acked;
@@ -3621,6 +3621,13 @@
 							iDupAcks = Max(iDupAcks - acked / (TInt)iSMSS, 0);
 							}
 						}
+					else if ( iDupAcks )
+                        {
+                        // New data acknowledged, and not ongoing any recovery action
+                        // Reset duplicate ack count
+                        LOG(Log::Printf(_L("\ttcp SAP[%u] ProcessSegments(): Reset iDupAcks to 0"), (TInt)this));
+                        iDupAcks = 0;
+                        }
 
 					// Reset limited transmit window
 					iLwnd = 0;
@@ -3796,16 +3803,8 @@
 						iFlags.iEcnSendCWR = ETrue;
 						}
 					}
-				if((iSND.NXT - ack) >0 && InState(ETcpEstablished) && (acked ==0))
-					{
-					iRetryAck++;
-					if(iRetryAck >=4) // 4 an arbitary number; as this count does not refer to dup_ack, this will not interfere with Fast retransmission
-						{
-						LOG(Log::Printf(_L("\ttcp SAP[%u] ProcessSegments(): retransmitting the segment"), (TInt)this));
-						SendSegments(ETrue);
-						iRetryAck = 0; // reset the retry count
-						}
-					}
+				// This section used to hold the RetryACK concept, a reference can be checked
+				// from older versions(9.2/9.3). Its being removed as not required.	
 					
 				}
 			}