axeld + bonefish:

* Small style changes.
* Currently ifdef'ed out potentially correct changes, that break Neon
  tests which otherwise succeed. Axel will investigate this further.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25530 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2008-05-17 18:48:24 +00:00
parent 91af9113d6
commit ec1f43f304
2 changed files with 35 additions and 5 deletions
@@ -466,7 +466,7 @@ TCPEndpoint::Close()
{ {
TRACE("Close()"); TRACE("Close()");
MutexLocker lock(fLock); MutexLocker locker(fLock);
if (fState == LISTEN) if (fState == LISTEN)
delete_sem(fAcceptSemaphore); delete_sem(fAcceptSemaphore);
@@ -488,7 +488,7 @@ TCPEndpoint::Close()
bigtime_t maximum = absolute_timeout(socket->linger * 1000000LL); bigtime_t maximum = absolute_timeout(socket->linger * 1000000LL);
while (fSendQueue.Used() > 0) { while (fSendQueue.Used() > 0) {
status = fSendList.Wait(lock, maximum); status = fSendList.Wait(locker, maximum);
if (status == B_TIMED_OUT || status == B_WOULD_BLOCK) if (status == B_TIMED_OUT || status == B_WOULD_BLOCK)
break; break;
else if (status < B_OK) else if (status < B_OK)
@@ -497,8 +497,22 @@ TCPEndpoint::Close()
TRACE("Close(): after waiting, the SendQ was left with %lu bytes.", TRACE("Close(): after waiting, the SendQ was left with %lu bytes.",
fSendQueue.Used()); fSendQueue.Used());
} #if 0
// TODO: For the following to work we also need to be notified when TIME_WAIT
// is entered.
} else if (fRoute != NULL && (fRoute->flags & RTF_LOCAL) != 0) {
// This is a local connection - just wait until we're done so that
// the port is available again
while (fState != CLOSED && fState != TIME_WAIT) {
if (socket->error != B_OK)
return socket->error;
status_t status = fSendList.Wait(locker);
if (status < B_OK)
return status;
}
#endif // 0
}
return B_OK; return B_OK;
} }
@@ -1117,7 +1131,13 @@ TCPEndpoint::_MarkEstablished()
status_t status_t
TCPEndpoint::_WaitForEstablished(MutexLocker &locker, bigtime_t timeout) TCPEndpoint::_WaitForEstablished(MutexLocker &locker, bigtime_t timeout)
{ {
#if 0
// TODO: Checking for CLOSED seems correct, but breaks several neon tests.
// When investigating this, also have a look at _Close() and _HandleReset().
while (fState < ESTABLISHED && fState != CLOSED) {
#else
while (fState < ESTABLISHED) { while (fState < ESTABLISHED) {
#endif
if (socket->error != B_OK) if (socket->error != B_OK)
return socket->error; return socket->error;
@@ -1141,6 +1161,13 @@ TCPEndpoint::_Close()
T(State(this)); T(State(this));
fFlags |= FLAG_DELETE_ON_CLOSE; fFlags |= FLAG_DELETE_ON_CLOSE;
#if 0
// TODO: Should probably be moved here (from _HandleReset()), but cf. the
// comment in _WaitForEstablished().
fSendList.Signal();
_NotifyReader();
#endif
} }
@@ -1150,8 +1177,11 @@ TCPEndpoint::_HandleReset(status_t error)
socket->error = error; socket->error = error;
_Close(); _Close();
#if 1
// TODO: Should be moved to _Close(), but cf. comment in _WaitForEstablished().
fSendList.Signal(); fSendList.Signal();
_NotifyReader(); _NotifyReader();
#endif
gSocketModule->notify(socket, B_SELECT_WRITE, error); gSocketModule->notify(socket, B_SELECT_WRITE, error);
gSocketModule->notify(socket, B_SELECT_ERROR, error); gSocketModule->notify(socket, B_SELECT_ERROR, error);
@@ -27,12 +27,12 @@
class WaitList { class WaitList {
public: public:
WaitList(const char *name); WaitList(const char* name);
~WaitList(); ~WaitList();
status_t InitCheck() const; status_t InitCheck() const;
status_t Wait(MutexLocker &, bigtime_t timeout); status_t Wait(MutexLocker& locker, bigtime_t timeout = B_INFINITE_TIMEOUT);
void Signal(); void Signal();
private: private: