Sigh, ignore previous commit, Open Group Specification is ambiguous. Now we properly support MSG_WAITALL.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20585 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos 2007-04-05 16:23:04 +00:00
parent 8927167d28
commit daad608a3a

View File

@ -498,10 +498,14 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
// read data out of buffer // read data out of buffer
// TODO: add support for urgent data (MSG_OOB) // TODO: add support for urgent data (MSG_OOB)
size_t dataNeeded = socket->receive.low_water_mark;
if (flags & MSG_WAITALL)
dataNeeded = numBytes;
bigtime_t timeout = system_time() + socket->receive.timeout; bigtime_t timeout = system_time() + socket->receive.timeout;
while (fReceiveQueue.PushedData() == 0 while (fReceiveQueue.PushedData() == 0
&& fReceiveQueue.Available() < numBytes && fReceiveQueue.Available() < dataNeeded
&& (fFlags & FLAG_NO_RECEIVE) == 0) { && (fFlags & FLAG_NO_RECEIVE) == 0) {
locker.Unlock(); locker.Unlock();
@ -510,8 +514,7 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
// block until the full amount of data can be returned. // block until the full amount of data can be returned.
status_t status = acquire_sem_etc(fReceiveLock, 1, status_t status = acquire_sem_etc(fReceiveLock, 1,
((flags & MSG_WAITALL) ? 0 : B_ABSOLUTE_TIMEOUT) B_ABSOLUTE_TIMEOUT | B_CAN_INTERRUPT, timeout);
| B_CAN_INTERRUPT, timeout);
locker.Lock(); locker.Lock();