From ae33c41ea857ca40e96f3fc549f125d27bc96c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 29 Apr 2008 08:39:08 +0000 Subject: [PATCH] * For local connections, we no longer use the TIME_WAIT state; in this case, we know that the connection was torn down cleanly, and there are no inflight segments floating around anymore. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25239 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/network/protocols/tcp/TCPEndpoint.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp index 6c2dd53740..28e70124d5 100644 --- a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp +++ b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp @@ -217,7 +217,8 @@ enum { // That is, what is expected from accept() after a shutdown() // is performed on a listen()ing socket. FLAG_NO_RECEIVE = 0x04, - FLAG_CLOSED = 0x08 + FLAG_CLOSED = 0x08, + FLAG_DELETE = 0x10, }; @@ -970,13 +971,14 @@ TCPEndpoint::_EnterTimeWait() { TRACE("_EnterTimeWait()\n"); - _CancelConnectionTimers(); -#if 0 if (fState == TIME_WAIT && fRoute != NULL - && (fRoute->flags & RTF_LOCAL) != 0) + && (fRoute->flags & RTF_LOCAL) != 0) { + // we do not use TIME_WAIT state for local connections + fFlags |= FLAG_DELETE; return; -#endif + } + _CancelConnectionTimers(); _UpdateTimeWait(); } @@ -1621,7 +1623,8 @@ TCPEndpoint::SegmentReceived(tcp_segment_header& segment, net_buffer* buffer) else if (segmentAction & ACKNOWLEDGE) DelayedAcknowledge(); - if (fState == CLOSED && (fFlags & FLAG_CLOSED) != 0) { + if ((fState == CLOSED && (fFlags & FLAG_CLOSED) != 0) + || (fFlags & FLAG_DELETE) != 0) { locker.Unlock(); gSocketModule->delete_socket(socket); // this will also delete us