1786 |
1786 |
1787 if (CanTriggerKeepAlive()) |
1787 if (CanTriggerKeepAlive()) |
1788 { |
1788 { |
1789 // The heaviest time check only if we are otherwise allowed to send the keepalive. |
1789 // The heaviest time check only if we are otherwise allowed to send the keepalive. |
1790 TUint32 time_now = TimeStamp(); |
1790 TUint32 time_now = TimeStamp(); |
1791 if (time_now - iLastTriggeredKeepAlive > KTcpKeepAliveTH * KOneSecondUs) |
1791 if (time_now - iLastTriggeredKeepAlive > KTcpKeepAliveTH * KOneSecondInMs) |
1792 { |
1792 { |
1793 iLastTriggeredKeepAlive = time_now; |
1793 iLastTriggeredKeepAlive = time_now; |
1794 LOG(Log::Printf(_L("\ttcp SAP[%u] CanSend(): Sending a Keep-Alive probe"), (TInt)this)); |
1794 LOG(Log::Printf(_L("\ttcp SAP[%u] CanSend(): Sending a Keep-Alive probe"), (TInt)this)); |
1795 SendSegment(KTcpCtlACK, iSND.UNA - 1, 0); |
1795 SendSegment(KTcpCtlACK, iSND.UNA - 1, 0); |
1796 } |
1796 } |
2445 TUint32 usec = TimeStamp(); |
2445 TUint32 usec = TimeStamp(); |
2446 |
2446 |
2447 if (!iLastTimeout) |
2447 if (!iLastTimeout) |
2448 iLastTimeout = usec; |
2448 iLastTimeout = usec; |
2449 |
2449 |
2450 TUint32 distance = (usec - iLastTimeout) / KOneSecondUs; // seconds |
2450 TUint32 distance = (usec - iLastTimeout) / KOneSecondInMs; // seconds |
2451 TUint32 interval = iBackoff ? Protocol()->KeepAliveRxmt() : Protocol()->KeepAliveIntv(); |
2451 TUint32 interval = iBackoff ? Protocol()->KeepAliveRxmt() : Protocol()->KeepAliveIntv(); |
2452 |
2452 |
2453 if (distance > interval) |
2453 if (distance > interval) |
2454 { |
2454 { |
2455 // Send a keepalive probe. If no ack arrives, next one is sent after a shorter time (75 s) |
2455 // Send a keepalive probe. If no ack arrives, next one is sent after a shorter time (75 s) |
2456 LOG(Log::Printf(_L("\ttcp SAP[%u] KeepAliveTimeout(): Sending a Keep-Alive probe"), (TInt)this)); |
2456 LOG(Log::Printf(_L("\ttcp SAP[%u] KeepAliveTimeout(): Sending a Keep-Alive probe"), (TInt)this)); |
2457 SendSegment(KTcpCtlACK, iSND.UNA - 1, 0); |
2457 SendSegment(KTcpCtlACK, iSND.UNA - 1, 0); |
2458 iBackoff++; |
2458 iBackoff++; |
2459 iRetransTimer->Restart(Protocol()->KeepAliveRxmt() * KOneSecondUs); |
2459 iRetransTimer->Restart(Protocol()->KeepAliveRxmt() * KOneSecondInUs); |
2460 } |
2460 } |
2461 else |
2461 else |
2462 { |
2462 { |
2463 // This branch is entered when the first keepalive has to be issued after an idle period. |
2463 // This branch is entered when the first keepalive has to be issued after an idle period. |
2464 distance = Protocol()->KeepAliveIntv() - distance; |
2464 distance = Protocol()->KeepAliveIntv() - distance; |
2465 iRetransTimer->Restart((distance > 1800) ? |
2465 iRetransTimer->Restart((distance > 1800) ? |
2466 1800 * KOneSecondUs : (distance * KOneSecondUs)); |
2466 1800 * KOneSecondInUs : (distance * KOneSecondInUs)); |
2467 } |
2467 } |
2468 } |
2468 } |
2469 |
2469 |
2470 |
2470 |
2471 void CProviderTCP6::ResetKeepAlives() |
2471 void CProviderTCP6::ResetKeepAlives() |
2472 { |
2472 { |
2473 ASSERT(iRetransTimer); |
2473 ASSERT(iRetransTimer); |
2474 iRetransTimer->Restart((Protocol()->KeepAliveIntv() > 1800) ? |
2474 iRetransTimer->Restart((Protocol()->KeepAliveIntv() > 1800) ? |
2475 1800 * KOneSecondUs : (Protocol()->KeepAliveIntv() * KOneSecondUs)); |
2475 1800 * KOneSecondInUs : (Protocol()->KeepAliveIntv() * KOneSecondInUs)); |
2476 // Backoff is used for counting unacknowledged keepalive retransmissions during idle periods |
2476 // Backoff is used for counting unacknowledged keepalive retransmissions during idle periods |
2477 iBackoff = 0; |
2477 iBackoff = 0; |
2478 iLastTimeout = TimeStamp(); |
2478 iLastTimeout = TimeStamp(); |
2479 } |
2479 } |
2480 |
2480 |
3716 // |
3716 // |
3717 ASSERT(iSMSS); |
3717 ASSERT(iSMSS); |
3718 iDupAcks = Max(iDupAcks - acked / (TInt)iSMSS, 0); |
3718 iDupAcks = Max(iDupAcks - acked / (TInt)iSMSS, 0); |
3719 } |
3719 } |
3720 } |
3720 } |
|
3721 else if ( iDupAcks ) |
|
3722 { |
|
3723 // New data acknowledged, and not ongoing any recovery action |
|
3724 // Reset duplicate ack count |
|
3725 LOG(Log::Printf(_L("\ttcp SAP[%u] ProcessSegments(): Reset iDupAcks to 0"), (TInt)this)); |
|
3726 iDupAcks = 0; |
|
3727 } |
3721 |
3728 |
3722 // Reset limited transmit window |
3729 // Reset limited transmit window |
3723 iLwnd = 0; |
3730 iLwnd = 0; |
3724 |
3731 |
3725 // Everything acked? |
3732 // Everything acked? |
3891 if (SourceQuench() || iQuenchSeq.Outside(iSND.NXT, iSND.NXT + iSND.WND)) |
3898 if (SourceQuench() || iQuenchSeq.Outside(iSND.NXT, iSND.NXT + iSND.WND)) |
3892 { |
3899 { |
3893 iFlags.iEcnSendCWR = ETrue; |
3900 iFlags.iEcnSendCWR = ETrue; |
3894 } |
3901 } |
3895 } |
3902 } |
|
3903 // This section used to hold the RetryACK concept, a reference can be checked |
|
3904 // from older versions(9.2/9.3). Its being removed as not required. |
|
3905 /* |
3896 if((iSND.NXT - ack) >0 && InState(ETcpEstablished) && (acked ==0)) |
3906 if((iSND.NXT - ack) >0 && InState(ETcpEstablished) && (acked ==0)) |
3897 { |
3907 { |
3898 iRetryAck++; |
3908 iRetryAck++; |
3899 if(iRetryAck >=4) // 4 an arbitary number; as this count does not refer to dup_ack, this will not interfere with Fast retransmission |
3909 if(iRetryAck >=4) // 4 an arbitary number; as this count does not refer to dup_ack, this will not interfere with Fast retransmission |
3900 { |
3910 { |
3901 LOG(Log::Printf(_L("\ttcp SAP[%u] ProcessSegments(): retransmitting the segment"), (TInt)this)); |
3911 LOG(Log::Printf(_L("\ttcp SAP[%u] ProcessSegments(): retransmitting the segment"), (TInt)this)); |
3902 SendSegments(ETrue); |
3912 SendSegments(ETrue); |
3903 iRetryAck = 0; // reset the retry count |
3913 iRetryAck = 0; // reset the retry count |
3904 } |
3914 } |
3905 } |
3915 } |
|
3916 */ |
3906 |
3917 |
3907 } |
3918 } |
3908 } |
3919 } |
3909 |
3920 |
3910 // |
3921 // |