* Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25240 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -570,8 +570,7 @@ TCPEndpoint::Connect(const sockaddr* address)
|
||||
// send SYN
|
||||
status = _SendQueued();
|
||||
if (status != B_OK) {
|
||||
fState = CLOSED;
|
||||
T(State(this));
|
||||
_Close();
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1062,14 +1061,26 @@ TCPEndpoint::_WaitForEstablished(MutexLocker &locker, bigtime_t timeout)
|
||||
|
||||
|
||||
void
|
||||
TCPEndpoint::_HandleReset(status_t error)
|
||||
TCPEndpoint::_Close()
|
||||
{
|
||||
_CancelConnectionTimers();
|
||||
|
||||
socket->error = error;
|
||||
fState = CLOSED;
|
||||
T(State(this));
|
||||
|
||||
if ((fFlags & FLAG_CLOSED) != 0) {
|
||||
// this socket has been closed already, we don't need to keep
|
||||
// it around anymore
|
||||
fFlags |= FLAG_DELETE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TCPEndpoint::_HandleReset(status_t error)
|
||||
{
|
||||
socket->error = error;
|
||||
_Close();
|
||||
|
||||
fSendList.Signal();
|
||||
_NotifyReader();
|
||||
|
||||
@@ -1486,6 +1497,7 @@ TCPEndpoint::_Receive(tcp_segment_header& segment, net_buffer* buffer)
|
||||
switch (fState) {
|
||||
case FINISH_SENT:
|
||||
fState = FINISH_ACKNOWLEDGED;
|
||||
T(State(this));
|
||||
break;
|
||||
case CLOSING:
|
||||
fState = TIME_WAIT;
|
||||
@@ -1493,15 +1505,12 @@ TCPEndpoint::_Receive(tcp_segment_header& segment, net_buffer* buffer)
|
||||
_EnterTimeWait();
|
||||
return DROP;
|
||||
case WAIT_FOR_FINISH_ACKNOWLEDGE:
|
||||
_CancelConnectionTimers();
|
||||
fState = CLOSED;
|
||||
_Close();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
T(State(this));
|
||||
}
|
||||
|
||||
if (fState != CLOSED)
|
||||
@@ -1623,8 +1632,7 @@ TCPEndpoint::SegmentReceived(tcp_segment_header& segment, net_buffer* buffer)
|
||||
else if (segmentAction & ACKNOWLEDGE)
|
||||
DelayedAcknowledge();
|
||||
|
||||
if ((fState == CLOSED && (fFlags & FLAG_CLOSED) != 0)
|
||||
|| (fFlags & FLAG_DELETE) != 0) {
|
||||
if ((fFlags & FLAG_DELETE) != 0) {
|
||||
locker.Unlock();
|
||||
gSocketModule->delete_socket(socket);
|
||||
// this will also delete us
|
||||
|
||||
@@ -85,6 +85,7 @@ private:
|
||||
void _StartPersistTimer();
|
||||
void _EnterTimeWait();
|
||||
void _UpdateTimeWait();
|
||||
void _Close();
|
||||
void _CancelConnectionTimers();
|
||||
uint8 _CurrentFlags();
|
||||
bool _ShouldSendSegment(tcp_segment_header& segment,
|
||||
|
||||
Reference in New Issue
Block a user