networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp
branchRCL_3
changeset 57 abbed5a4b42a
parent 53 7e41d162e158
child 58 8d540f55e491
--- a/networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp	Thu Aug 19 11:25:30 2010 +0300
+++ b/networkprotocols/tcpipv4v6prt/src/tcp_sap.cpp	Tue Aug 31 16:45:15 2010 +0300
@@ -140,8 +140,7 @@
 //  state chart above. It would be located between CLOSED and SYN-SENT.
 //
 
-//The below is UID of the client(http client) using this option. We are not exposing this right now...
-const TUint32 KSoTcpLingerinMicroSec = 0x101F55F6;
+
 #ifdef _LOG
 const TText *CProviderTCP6::TcpState(TUint aState)
 	{
@@ -792,11 +791,6 @@
 				}
 			break;
 
-		case KSoTcpLingerinMicroSec:
-            RDebug::Printf("TSoTcpLingerinMicroSec is set");
-            //Enable micro sec calculation for TCP linger timer. User (currently just exposed to browser)
-            //will specify linger time in microsecs. 
-            iMicroSecCalcFlag=ETrue;           
 		case KSoTcpLinger:
 			if (aOption.Length() < (TInt)sizeof(TSoTcpLingerOpt))
 				{
@@ -1204,16 +1198,7 @@
 			// Start linger timer. RSocket::Close() returns when timer
 			// expires or when all data has been succesfully transmitted.
 			//
-		    if(iMicroSecCalcFlag)
-                {
-                //expecting iLinger timer to be specified in microsec.This will be set currently by browser where in
-                //it is expected to be close with in certian time
-                iLingerTimer->Start(iLinger * 1);
-                }
-            else
-                {
-                iLingerTimer->Start(iLinger * KOneSecondInUs);
-                }			
+			iLingerTimer->Start(iLinger * KOneSecondUs);
 			}
 		SchedTransmit();
 
@@ -1803,7 +1788,7 @@
 			{
 			// The heaviest time check only if we are otherwise allowed to send the keepalive.
 			TUint32 time_now = TimeStamp();
-			if (time_now - iLastTriggeredKeepAlive > KTcpKeepAliveTH * KOneSecondInMs)
+			if (time_now - iLastTriggeredKeepAlive > KTcpKeepAliveTH * KOneSecondUs)
 				{
 				iLastTriggeredKeepAlive = time_now;
 				LOG(Log::Printf(_L("\ttcp SAP[%u] CanSend(): Sending a Keep-Alive probe"), (TInt)this));
@@ -2462,7 +2447,7 @@
 	if (!iLastTimeout)
 		iLastTimeout = usec;
 
-	TUint32 distance = (usec - iLastTimeout) / KOneSecondInMs;  // seconds
+	TUint32 distance = (usec - iLastTimeout) / KOneSecondUs;  // seconds
 	TUint32 interval = iBackoff ? Protocol()->KeepAliveRxmt() : Protocol()->KeepAliveIntv();
 
 	if (distance > interval)
@@ -2471,14 +2456,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() * KOneSecondInUs);
+		iRetransTimer->Restart(Protocol()->KeepAliveRxmt() * KOneSecondUs);
 		}
 	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 * KOneSecondInUs : (distance * KOneSecondInUs));
+			1800 * KOneSecondUs : (distance * KOneSecondUs));
 		}
 	}
 
@@ -2487,7 +2472,7 @@
 	{
 	ASSERT(iRetransTimer);
 	iRetransTimer->Restart((Protocol()->KeepAliveIntv() > 1800) ?
-		1800 * KOneSecondInUs : (Protocol()->KeepAliveIntv() * KOneSecondInUs));
+		1800 * KOneSecondUs : (Protocol()->KeepAliveIntv() * KOneSecondUs));
 	// Backoff is used for counting unacknowledged keepalive retransmissions during idle periods
 	iBackoff = 0;
 	iLastTimeout = TimeStamp();
@@ -3703,20 +3688,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;
@@ -3733,13 +3718,6 @@
 							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;
@@ -3915,8 +3893,16 @@
 						iFlags.iEcnSendCWR = ETrue;
 						}
 					}
-				// 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.	
+				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
+						}
+					}
 					
 				}
 			}