From 204aa45b0b9d3f97b5619f1940c24b4853073387 Mon Sep 17 00:00:00 2001 From: Hugo Santos Date: Sat, 21 Apr 2007 02:37:17 +0000 Subject: [PATCH] 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 --- .../kernel/network/protocols/tcp/TCPEndpoint.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp index 67a9bb025a..84df621a3f 100644 --- a/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp +++ b/src/add-ons/kernel/network/protocols/tcp/TCPEndpoint.cpp @@ -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; }