* 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
|
// send SYN
|
||||||
status = _SendQueued();
|
status = _SendQueued();
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
fState = CLOSED;
|
_Close();
|
||||||
T(State(this));
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1062,14 +1061,26 @@ TCPEndpoint::_WaitForEstablished(MutexLocker &locker, bigtime_t timeout)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TCPEndpoint::_HandleReset(status_t error)
|
TCPEndpoint::_Close()
|
||||||
{
|
{
|
||||||
_CancelConnectionTimers();
|
_CancelConnectionTimers();
|
||||||
|
|
||||||
socket->error = error;
|
|
||||||
fState = CLOSED;
|
fState = CLOSED;
|
||||||
T(State(this));
|
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();
|
fSendList.Signal();
|
||||||
_NotifyReader();
|
_NotifyReader();
|
||||||
|
|
||||||
@@ -1486,6 +1497,7 @@ TCPEndpoint::_Receive(tcp_segment_header& segment, net_buffer* buffer)
|
|||||||
switch (fState) {
|
switch (fState) {
|
||||||
case FINISH_SENT:
|
case FINISH_SENT:
|
||||||
fState = FINISH_ACKNOWLEDGED;
|
fState = FINISH_ACKNOWLEDGED;
|
||||||
|
T(State(this));
|
||||||
break;
|
break;
|
||||||
case CLOSING:
|
case CLOSING:
|
||||||
fState = TIME_WAIT;
|
fState = TIME_WAIT;
|
||||||
@@ -1493,15 +1505,12 @@ TCPEndpoint::_Receive(tcp_segment_header& segment, net_buffer* buffer)
|
|||||||
_EnterTimeWait();
|
_EnterTimeWait();
|
||||||
return DROP;
|
return DROP;
|
||||||
case WAIT_FOR_FINISH_ACKNOWLEDGE:
|
case WAIT_FOR_FINISH_ACKNOWLEDGE:
|
||||||
_CancelConnectionTimers();
|
_Close();
|
||||||
fState = CLOSED;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
T(State(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fState != CLOSED)
|
if (fState != CLOSED)
|
||||||
@@ -1623,8 +1632,7 @@ TCPEndpoint::SegmentReceived(tcp_segment_header& segment, net_buffer* buffer)
|
|||||||
else if (segmentAction & ACKNOWLEDGE)
|
else if (segmentAction & ACKNOWLEDGE)
|
||||||
DelayedAcknowledge();
|
DelayedAcknowledge();
|
||||||
|
|
||||||
if ((fState == CLOSED && (fFlags & FLAG_CLOSED) != 0)
|
if ((fFlags & FLAG_DELETE) != 0) {
|
||||||
|| (fFlags & FLAG_DELETE) != 0) {
|
|
||||||
locker.Unlock();
|
locker.Unlock();
|
||||||
gSocketModule->delete_socket(socket);
|
gSocketModule->delete_socket(socket);
|
||||||
// this will also delete us
|
// this will also delete us
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ private:
|
|||||||
void _StartPersistTimer();
|
void _StartPersistTimer();
|
||||||
void _EnterTimeWait();
|
void _EnterTimeWait();
|
||||||
void _UpdateTimeWait();
|
void _UpdateTimeWait();
|
||||||
|
void _Close();
|
||||||
void _CancelConnectionTimers();
|
void _CancelConnectionTimers();
|
||||||
uint8 _CurrentFlags();
|
uint8 _CurrentFlags();
|
||||||
bool _ShouldSendSegment(tcp_segment_header& segment,
|
bool _ShouldSendSegment(tcp_segment_header& segment,
|
||||||
|
|||||||
Reference in New Issue
Block a user