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:
parent
8927167d28
commit
daad608a3a
@ -498,10 +498,14 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
|
||||
// read data out of buffer
|
||||
// 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;
|
||||
|
||||
while (fReceiveQueue.PushedData() == 0
|
||||
&& fReceiveQueue.Available() < numBytes
|
||||
&& fReceiveQueue.Available() < dataNeeded
|
||||
&& (fFlags & FLAG_NO_RECEIVE) == 0) {
|
||||
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.
|
||||
|
||||
status_t status = acquire_sem_etc(fReceiveLock, 1,
|
||||
((flags & MSG_WAITALL) ? 0 : B_ABSOLUTE_TIMEOUT)
|
||||
| B_CAN_INTERRUPT, timeout);
|
||||
B_ABSOLUTE_TIMEOUT | B_CAN_INTERRUPT, timeout);
|
||||
|
||||
locker.Lock();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user