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

(-)a/examples/tcp-large-transfer.cc (-1 / +1 lines)
 Lines 212-216    Link Here 
212
        return;
212
        return;
213
      }
213
      }
214
  }
214
  }
215
  localSocket->Close ();
215
  localSocket->ShutdownSend ();
216
}
216
}
(-)a/src/internet-stack/tcp-socket-impl.cc (-12 / +26 lines)
 Lines 73-78    Link Here 
73
    m_closeRequestNotified (false),
73
    m_closeRequestNotified (false),
74
    m_closeOnEmpty (false),
74
    m_closeOnEmpty (false),
75
    m_pendingClose (false),
75
    m_pendingClose (false),
76
    m_closeCalled (false),
76
    m_nextTxSequence (0),
77
    m_nextTxSequence (0),
77
    m_highTxMark (0),
78
    m_highTxMark (0),
78
    m_highestRxAck (0),
79
    m_highestRxAck (0),
 Lines 112-117    Link Here 
112
    m_closeRequestNotified (sock.m_closeRequestNotified),
113
    m_closeRequestNotified (sock.m_closeRequestNotified),
113
    m_closeOnEmpty (sock.m_closeOnEmpty),
114
    m_closeOnEmpty (sock.m_closeOnEmpty),
114
    m_pendingClose (sock.m_pendingClose),
115
    m_pendingClose (sock.m_pendingClose),
116
    m_closeCalled (sock.m_closeCalled),
115
    m_nextTxSequence (sock.m_nextTxSequence),
117
    m_nextTxSequence (sock.m_nextTxSequence),
116
    m_highTxMark (sock.m_highTxMark),
118
    m_highTxMark (sock.m_highTxMark),
117
    m_highestRxAck (sock.m_highestRxAck),
119
    m_highestRxAck (sock.m_highestRxAck),
 Lines 294-299    Link Here 
294
TcpSocketImpl::ShutdownSend (void)
296
TcpSocketImpl::ShutdownSend (void)
295
{
297
{
296
  NS_LOG_FUNCTION_NOARGS ();
298
  NS_LOG_FUNCTION_NOARGS ();
299
  if (m_pendingData && m_pendingData->Size() != 0)
300
  { // App close with pending data must wait until all data transmitted
301
    m_closeOnEmpty = true;
302
    NS_LOG_LOGIC("Socket " << this << 
303
                 " deferring close, state " << m_state);
304
    return 0;
305
  }
306
  
307
  Actions_t action  = ProcessEvent (APP_CLOSE);
308
  ProcessAction (action);
297
  m_shutdownSend = true;
309
  m_shutdownSend = true;
298
  return 0;
310
  return 0;
299
}
311
}
 Lines 308-325    Link Here 
308
int
320
int
309
TcpSocketImpl::Close (void)
321
TcpSocketImpl::Close (void)
310
{
322
{
311
  NS_LOG_FUNCTION_NOARGS ();
323
  if (GetRxAvailable () > 0)
312
  if (m_pendingData && m_pendingData->Size() != 0)
324
  {
313
    { // App close with pending data must wait until all data transmitted
325
    ProcessAction (RST_TX);
314
      m_closeOnEmpty = true;
326
  }
315
      NS_LOG_LOGIC("Socket " << this << 
327
  else 
316
                   " deferring close, state " << m_state);
328
  {
317
      return 0;
329
    ShutdownSend();
318
    }
330
  }
319
331
  m_closeCalled = true;
320
  Actions_t action  = ProcessEvent (APP_CLOSE);
321
  ProcessAction (action);
322
  ShutdownSend ();
323
  return 0;
332
  return 0;
324
}
333
}
325
334
 Lines 1125-1130    Link Here 
1125
                " seq " << tcpHeader.GetSequenceNumber() <<
1134
                " seq " << tcpHeader.GetSequenceNumber() <<
1126
                " ack " << tcpHeader.GetAckNumber() <<
1135
                " ack " << tcpHeader.GetAckNumber() <<
1127
                " p.size is " << p->GetSize());
1136
                " p.size is " << p->GetSize());
1137
  if(m_closeCalled) //send RST accordingly
1138
  {
1139
    ProcessAction(RST_TX);
1140
    return;
1141
  }
1128
  States_t origState = m_state;
1142
  States_t origState = m_state;
1129
  if (RxBufferFreeSpace() < p->GetSize()) 
1143
  if (RxBufferFreeSpace() < p->GetSize()) 
1130
    { //if not enough room, fragment
1144
    { //if not enough room, fragment
(-)a/src/internet-stack/tcp-socket-impl.h (+1 lines)
 Lines 191-196    Link Here 
191
  bool m_closeRequestNotified;
191
  bool m_closeRequestNotified;
192
  bool m_closeOnEmpty;
192
  bool m_closeOnEmpty;
193
  bool m_pendingClose;
193
  bool m_pendingClose;
194
  bool m_closeCalled;
194
195
195
  
196
  
196
  //sequence info, sender side
197
  //sequence info, sender side

Return to bug 426