|
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), |
|
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), |
|
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 |
} |
|
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 |
|
|
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 |