Skip to content

Commit

Permalink
[core] fix recv_WaitForReadReady() return empty
Browse files Browse the repository at this point in the history
  • Loading branch information
gou4shi1 authored and maxsharabayko committed Dec 6, 2021
1 parent 40b5129 commit 1d808c1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions srtcore/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2041,6 +2041,7 @@ vector<CUDTSocket*> CUDTGroup::recv_WaitForReadReady(const vector<CUDTSocket*>&
// This can only happen when 0 is passed as timeout and none is ready.
// And 0 is passed only in non-blocking mode. So this is none ready in
// non-blocking mode.
m_Global.m_EPoll.update_events(id(), m_sPollID, SRT_EPOLL_IN, false);
throw CUDTException(MJ_AGAIN, MN_RDAVAIL, 0);
}

Expand Down Expand Up @@ -2329,6 +2330,14 @@ int CUDTGroup::recv(char* buf, int len, SRT_MSGCTRL& w_mc)
// m_GlobControlLock lifted, m_GroupLock still locked.
// Now we can safely do this scoped way.

if (!m_bSynRecving && ready_sockets.empty())
{
HLOGC(grlog.Debug,
log << "group/rcv $" << m_GroupID << ": Not available AT THIS TIME, NOT READ-READY now.");
m_Global.m_EPoll.update_events(id(), m_sPollID, SRT_EPOLL_IN, false);
throw CUDTException(MJ_AGAIN, MN_RDAVAIL, 0);
}

// Ok, now we need to have some extra qualifications:
// 1. If a socket has no registry yet, we read anyway, just
// to notify the current position. We read ONLY ONE PACKET this time,
Expand Down

0 comments on commit 1d808c1

Please sign in to comment.