View | Details | Raw Unified | Return to bug 902
Collapse All | Expand All

(-)a/src/internet-stack/tcp-socket-impl.cc (-7 / +17 lines)
 Lines 82-87    Link Here 
82
    m_highestRxAck (0),
82
    m_highestRxAck (0),
83
    m_lastRxAck (0),
83
    m_lastRxAck (0),
84
    m_nextRxSequence (0),
84
    m_nextRxSequence (0),
85
    m_finSequence (0),
85
    m_rxAvailable (0),
86
    m_rxAvailable (0),
86
    m_rxBufSize (0),
87
    m_rxBufSize (0),
87
    m_pendingData (0),
88
    m_pendingData (0),
 Lines 119-124    Link Here 
119
    m_highestRxAck (sock.m_highestRxAck),
120
    m_highestRxAck (sock.m_highestRxAck),
120
    m_lastRxAck (sock.m_lastRxAck),
121
    m_lastRxAck (sock.m_lastRxAck),
121
    m_nextRxSequence (sock.m_nextRxSequence),
122
    m_nextRxSequence (sock.m_nextRxSequence),
123
    m_finSequence (sock.m_finSequence),
122
    m_rxAvailable (0),
124
    m_rxAvailable (0),
123
    m_rxBufSize (0),
125
    m_rxBufSize (0),
124
    m_pendingData (0),
126
    m_pendingData (0),
 Lines 345-350    Link Here 
345
                   " deferring close, state " << m_state);
347
                   " deferring close, state " << m_state);
346
      return 0;
348
      return 0;
347
    }
349
    }
350
  m_finSequence = m_nextTxSequence + SequenceNumber (1);
348
  Actions_t action  = ProcessEvent (APP_CLOSE);
351
  Actions_t action  = ProcessEvent (APP_CLOSE);
349
  ProcessAction (action);
352
  ProcessAction (action);
350
  return 0;
353
  return 0;
 Lines 943-948    Link Here 
943
      if(tcpHeader.GetFlags() & TcpHeader::FIN)
946
      if(tcpHeader.GetFlags() & TcpHeader::FIN)
944
      {
947
      {
945
        ++m_nextRxSequence; //bump this to account for the FIN
948
        ++m_nextRxSequence; //bump this to account for the FIN
949
        m_nextTxSequence = m_finSequence;
946
      }
950
      }
947
      SendEmptyPacket (TcpHeader::ACK);
951
      SendEmptyPacket (TcpHeader::ACK);
948
      break;
952
      break;
 Lines 1037-1049    Link Here 
1037
      // out of sequence.  If so, note pending close and process
1041
      // out of sequence.  If so, note pending close and process
1038
      // new sequence rx
1042
      // new sequence rx
1039
      if (tcpHeader.GetSequenceNumber () != m_nextRxSequence)
1043
      if (tcpHeader.GetSequenceNumber () != m_nextRxSequence)
1040
        { // process close later
1044
        {
1041
          m_pendingClose = true;
1045
          if (m_finSequence != m_nextRxSequence)
1042
          NS_LOG_LOGIC ("TcpSocketImpl " << this << " setting pendingClose" 
1046
            {
1043
            << " rxseq " << tcpHeader.GetSequenceNumber () 
1047
              // process close later
1044
            << " nextRxSeq " << m_nextRxSequence);
1048
              m_finSequence = tcpHeader.GetSequenceNumber () + SequenceNumber (p->GetSize ());
1045
          NewRx (p, tcpHeader, fromAddress, toAddress);
1049
              m_pendingClose = true;
1046
          return true;
1050
              NS_LOG_LOGIC ("TcpSocketImpl " << this << " setting pendingClose" 
1051
                << " rxseq " << tcpHeader.GetSequenceNumber () 
1052
                << " nextRxSeq " << m_nextRxSequence);
1053
              NewRx (p, tcpHeader, fromAddress, toAddress);
1054
              return true;
1055
            }
1047
        }
1056
        }
1048
      // Now we need to see if any data came with the FIN
1057
      // Now we need to see if any data came with the FIN
1049
      // if so, call NewRx
1058
      // if so, call NewRx
 Lines 1159-1164    Link Here 
1159
          m_nextTxSequence + SequenceNumber (sz));
1168
          m_nextTxSequence + SequenceNumber (sz));
1160
      if (m_closeOnEmpty && (remainingData == 0))
1169
      if (m_closeOnEmpty && (remainingData == 0))
1161
        {
1170
        {
1171
          m_finSequence = m_nextTxSequence + SequenceNumber (1 + sz);
1162
          flags = TcpHeader::FIN;
1172
          flags = TcpHeader::FIN;
1163
          m_state = FIN_WAIT_1;
1173
          m_state = FIN_WAIT_1;
1164
        }
1174
        }
(-)a/src/internet-stack/tcp-socket-impl.h (+3 lines)
 Lines 202-207    Link Here 
202
  //sequence info, receiver side
202
  //sequence info, receiver side
203
  SequenceNumber m_nextRxSequence; //next expected sequence
203
  SequenceNumber m_nextRxSequence; //next expected sequence
204
204
205
  //sequence number where fin was received
206
  SequenceNumber m_finSequence;
207
205
  //Rx buffer
208
  //Rx buffer
206
  UnAckData_t m_bufferedData; //buffer which sorts out of sequence data
209
  UnAckData_t m_bufferedData; //buffer which sorts out of sequence data
207
  //Rx buffer state
210
  //Rx buffer state

Return to bug 902