fix locking in TCP's ReadData()
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20567 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
9e7de14057
commit
8c43814982
@ -471,17 +471,21 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
|
||||
{
|
||||
TRACE("ReadData(%lu bytes)", numBytes);
|
||||
|
||||
//BenaphoreLocker lock(&fReceiveLock);
|
||||
RecursiveLocker locker(fLock);
|
||||
|
||||
if (fState == SYNCHRONIZE_SENT || fState == SYNCHRONIZE_RECEIVED) {
|
||||
// we need to wait until the connection becomes established
|
||||
if (flags & MSG_DONTWAIT)
|
||||
return B_WOULD_BLOCK;
|
||||
|
||||
locker.Unlock();
|
||||
|
||||
status_t status = acquire_sem_etc(fSendLock, 1,
|
||||
B_RELATIVE_TIMEOUT | B_CAN_INTERRUPT, socket->receive.timeout);
|
||||
if (status < B_OK)
|
||||
return status;
|
||||
|
||||
locker.Lock();
|
||||
}
|
||||
|
||||
if ((fFlags & FLAG_NO_RECEIVE) != 0 && fReceiveQueue.Available() == 0) {
|
||||
@ -496,8 +500,6 @@ TCPEndpoint::ReadData(size_t numBytes, uint32 flags, net_buffer** _buffer)
|
||||
|
||||
bigtime_t timeout = system_time() + socket->receive.timeout;
|
||||
|
||||
RecursiveLocker locker(fLock);
|
||||
|
||||
do {
|
||||
locker.Unlock();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user