The Open Group base specification mentions that EINTR should be returned if the recv() is interrupted before _any data_ is available. So we actually check if there is data, and if so, push it to the user.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20593 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos 2007-04-05 23:26:39 +00:00
parent d86f48f3f5
commit 8d00b95aa9
1 changed files with 6 additions and 3 deletions

View File

@ -519,9 +519,12 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
locker.Lock(); locker.Lock();
if (status < B_OK) { if (status < B_OK) {
// TODO: If we are timing out, should we push the // The Open Group base specification mentions that EINTR should be
// available data to the user? // returned if the recv() is interrupted before _any data_ is
if (status == B_TIMED_OUT && fReceiveQueue.Available() > 0) // available. So we actually check if there is data, and if so,
// push it to the user.
if ((status == B_TIMED_OUT || status == B_INTERRUPTED)
&& fReceiveQueue.Available() > 0)
break; break;
return status; return status;
} }