Skip to content

Commit

Permalink
[core] Added missing RCV buffer lock
Browse files Browse the repository at this point in the history
in CUDT::receiveBuffer(..).

Co-authored-by: Maxim Sharabayko <maxsharabayko@haivision.com>
  • Loading branch information
gou4shi1 and maxsharabayko committed Jul 21, 2021
1 parent 96a41db commit 65ae257
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6108,7 +6108,9 @@ int srt::CUDT::receiveBuffer(char *data, int len)
throw CUDTException(MJ_CONNECTION, MN_CONNLOST, 0);
}

enterCS(m_RcvBufferLock);
const int res = m_pRcvBuffer->readBuffer(data, len);
leaveCS(m_RcvBufferLock);

/* Kick TsbPd thread to schedule next wakeup (if running) */
if (m_bTsbPd)
Expand Down Expand Up @@ -7056,7 +7058,9 @@ int64_t srt::CUDT::recvfile(fstream &ofs, int64_t &offset, int64_t size, int blo
}

unitsize = int((torecv > block) ? block : torecv);
enterCS(m_RcvBufferLock);
recvsize = m_pRcvBuffer->readBufferToFile(ofs, unitsize);
leaveCS(m_RcvBufferLock);

if (recvsize > 0)
{
Expand Down

0 comments on commit 65ae257

Please sign in to comment.