allow window updates to be sent after consuming data from the receive buffer. This fixes an issue where people were experiencing hangs in TCP downloads.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20777 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Hugo Santos 2007-04-21 02:37:17 +00:00
parent f1b088e623
commit 204aa45b0b
1 changed files with 8 additions and 2 deletions

View File

@ -666,11 +666,17 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
if (numBytes < fReceiveQueue.Available())
fReceiveList.Signal();
ssize_t receivedBytes = fReceiveQueue.Get(numBytes,
(flags & MSG_PEEK) == 0, _buffer);
bool clone = (flags & MSG_PEEK);
ssize_t receivedBytes = fReceiveQueue.Get(numBytes, !clone, _buffer);
TRACE(" ReadData(): %lu bytes kept.", fReceiveQueue.Available());
if (!clone) {
// we are opening the window, check if we should send an ACK
_SendQueued();
}
return receivedBytes;
}