Fixed a TCP issue reported by Stephan. Make sure we have enough PSH'ed bytes in the receive buffer before breaking the RX loop.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20619 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -470,7 +470,7 @@ TCPEndpoint::SendAvailable()
|
|||||||
status_t
|
status_t
|
||||||
TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
|
TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
|
||||||
{
|
{
|
||||||
TRACE("ReadData(%lu bytes)", numBytes);
|
TRACE("ReadData(%lu bytes, flags 0x%x)", numBytes, (unsigned int)flags);
|
||||||
|
|
||||||
RecursiveLocker locker(fLock);
|
RecursiveLocker locker(fLock);
|
||||||
|
|
||||||
@@ -510,9 +510,10 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
|
|||||||
if (timeout != B_INFINITE_TIMEOUT)
|
if (timeout != B_INFINITE_TIMEOUT)
|
||||||
timeout += system_time();
|
timeout += system_time();
|
||||||
|
|
||||||
while (fReceiveQueue.PushedData() == 0
|
while ((fFlags & FLAG_NO_RECEIVE) == 0
|
||||||
&& fReceiveQueue.Available() < dataNeeded
|
&& fReceiveQueue.Available() < dataNeeded
|
||||||
&& (fFlags & FLAG_NO_RECEIVE) == 0) {
|
&& (fReceiveQueue.PushedData() == 0
|
||||||
|
|| fReceiveQueue.Available() < fReceiveQueue.PushedData())) {
|
||||||
locker.Unlock();
|
locker.Unlock();
|
||||||
|
|
||||||
status_t status = acquire_sem_etc(fReceiveLock, 1,
|
status_t status = acquire_sem_etc(fReceiveLock, 1,
|
||||||
@@ -532,8 +533,8 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("ReadData(): read %lu bytes, %lu are available",
|
TRACE("ReadData(): read %lu bytes, %lu are available (flags 0x%x)",
|
||||||
numBytes, fReceiveQueue.Available());
|
numBytes, fReceiveQueue.Available(), (unsigned int)fFlags);
|
||||||
|
|
||||||
if (numBytes < fReceiveQueue.Available())
|
if (numBytes < fReceiveQueue.Available())
|
||||||
release_sem_etc(fReceiveLock, 1, B_DO_NOT_RESCHEDULE);
|
release_sem_etc(fReceiveLock, 1, B_DO_NOT_RESCHEDULE);
|
||||||
|
|||||||
Reference in New Issue
Block a user