diff --git a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp index 61f010adf8..476200681c 100644 --- a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp +++ b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp @@ -1138,14 +1138,16 @@ TCPEndpoint::_StartPersistTimer() void TCPEndpoint::_EnterTimeWait() { - TRACE("_EnterTimeWait()\n"); + TRACE("_EnterTimeWait()"); - _CancelConnectionTimers(); + if (fState == TIME_WAIT) { + _CancelConnectionTimers(); - if (fState == TIME_WAIT && IsLocal()) { - // we do not use TIME_WAIT state for local connections - fFlags |= FLAG_DELETE_ON_CLOSE; - return; + if (IsLocal()) { + // we do not use TIME_WAIT state for local connections + fFlags |= FLAG_DELETE_ON_CLOSE; + return; + } } _UpdateTimeWait();