From cbdd676aa50d4517eb634f54ece27f93894f4f0d Mon Sep 17 00:00:00 2001 From: "guangqing.chen" Date: Sat, 21 Aug 2021 15:50:53 +0800 Subject: [PATCH] [core] Added missing lock for isRcvDataReady() --- srtcore/group.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/srtcore/group.cpp b/srtcore/group.cpp index 2c9bf5f6d..e835453ea 100644 --- a/srtcore/group.cpp +++ b/srtcore/group.cpp @@ -2071,11 +2071,13 @@ vector CUDTGroup::recv_WaitForReadReady(const vector& readReady.push_back(*sockiter); } - else if (sock->core().m_pRcvBuffer->isRcvDataReady()) + else { // No read-readiness reported by epoll, but probably missed or not yet handled // as the receiver buffer is read-ready. - readReady.push_back(sock); + ScopedLock lg(sock->core().m_RcvBufferLock); + if (sock->core().m_pRcvBuffer && sock->core().m_pRcvBuffer->isRcvDataReady()) + readReady.push_back(sock); } }