Ticket #13631: tcp-rfc-3042-implemented-limited-trasmit.patch

File tcp-rfc-3042-implemented-limited-trasmit.patch, 2.4 KB (added by a-star, 3 years ago)
  • src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp

    From 7a8f036fcd12de1bc434a99948dd43f306b3e989 Mon Sep 17 00:00:00 2001
    From: A-star-ayush <myselfthebest@yahoo.com>
    Date: Wed, 26 Jul 2017 01:09:03 +0530
    Subject: [PATCH] tcp: rfc 3042: implemented limited trasmit
    
    ---
     .../kernel/network/protocols/tcp/TCPEndpoint.cpp   | 22 ++++++++++++++++++----
     1 file changed, 18 insertions(+), 4 deletions(-)
    
    diff --git a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp
    index 0a7c5fa..d347ffe 100644
    a b TCPEndpoint::_HandleReset(status_t error)  
    12751275void
    12761276TCPEndpoint::_DuplicateAcknowledge(tcp_segment_header &segment)
    12771277{
    1278     if (++fDuplicateAcknowledgeCount < 3)
     1278    if (++fDuplicateAcknowledgeCount < 3) {
     1279        if (fSendQueue.Available(fSendMax) != 0  && fSendWindow != 0) {
     1280            fSendNext = fSendMax;
     1281            fCongestionWindow += fDuplicateAcknowledgeCount * fSendMaxSegmentSize;
     1282            _SendQueued();
     1283            TRACE("_DuplicateAcknowledge(): packet sent under limited transmit on receipt of dup ack");
     1284            fCongestionWindow -= fDuplicateAcknowledgeCount * fSendMaxSegmentSize;
     1285        }
    12791286        return;
     1287    }
    12801288
    12811289    if (fDuplicateAcknowledgeCount == 3) {
    12821290        _ResetSlowStart();
    TCPEndpoint::_Receive(tcp_segment_header& segment, net_buffer* buffer)  
    16761684        if (fSendMax < segment.acknowledge)
    16771685            return DROP | IMMEDIATE_ACKNOWLEDGE;
    16781686
    1679         if (segment.acknowledge < fSendUnacknowledged) {
     1687        if (segment.acknowledge == fSendUnacknowledged) {
    16801688            if (buffer->size == 0 && advertisedWindow == fSendWindow
    1681                 && (segment.flags & TCP_FLAG_FINISH) == 0) {
     1689                && (segment.flags & TCP_FLAG_FINISH) == 0 && fSendUnacknowledged != fSendMax) {
    16821690                TRACE("Receive(): duplicate ack!");
    16831691
    16841692                _DuplicateAcknowledge(segment);
     1693                return DROP;
    16851694            }
    1686 
     1695        } else if (segment.acknowledge < fSendUnacknowledged) {
    16871696            return DROP;
    16881697        } else {
    16891698            // this segment acknowledges in flight data
    TCPEndpoint::_SendQueued(bool force, uint32 sendWindow)  
    20322041    bool shouldStartRetransmitTimer = fSendNext == fSendUnacknowledged;
    20332042    bool retransmit = fSendNext < fSendMax;
    20342043
     2044    if(fDuplicateAcknowledgeCount != 0) {
     2045        // send at most 1 SMSS of data when under limited transmit, fast transmit/recovery
     2046        length = min_c(length, fSendMaxSegmentSize);
     2047    }
     2048
    20352049    do {
    20362050        uint32 segmentMaxSize = fSendMaxSegmentSize
    20372051            - tcp_options_length(segment);