support MSG_WAITALL in TCP

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20584 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos
2007-04-05 16:16:51 +00:00
parent 485a82e613
commit 8927167d28
@@ -505,14 +505,19 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
&& (fFlags & FLAG_NO_RECEIVE) == 0) {
locker.Unlock();
// Open Group Base Specification states that when
// MSG_WAITALL is set then the function should
// block until the full amount of data can be returned.
status_t status = acquire_sem_etc(fReceiveLock, 1,
B_ABSOLUTE_TIMEOUT | B_CAN_INTERRUPT, timeout);
((flags & MSG_WAITALL) ? 0 : B_ABSOLUTE_TIMEOUT)
| B_CAN_INTERRUPT, timeout);
locker.Lock();
if (status < B_OK) {
// TODO: If we are timing out, should we push the
// available data?
// available data to the user?
if (status == B_TIMED_OUT && fReceiveQueue.Available() > 0)
break;
return status;