From cdafca58167659db7a22235b14b00eefe9d25193 Mon Sep 17 00:00:00 2001 From: Guangqing Chen Date: Thu, 23 Jun 2022 16:33:58 +0800 Subject: [PATCH] [core] Fix sendBroadcast() message length (#2391). The number of blocked member links was submitted instead of the buffer length. --- srtcore/group.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/srtcore/group.cpp b/srtcore/group.cpp index d25adc7ec..4847efe63 100644 --- a/srtcore/group.cpp +++ b/srtcore/group.cpp @@ -1517,8 +1517,6 @@ int CUDTGroup::sendBroadcast(const char* buf, int len, SRT_MSGCTRL& w_mc) CUDT::uglobal().epoll_add_usock_INTERNAL(m_SndEID, (*b)->ps, &modes); } - const int blocklen = blocked.size(); - int blst = 0; CEPoll::fmap_t sready; @@ -1582,8 +1580,8 @@ int CUDTGroup::sendBroadcast(const char* buf, int len, SRT_MSGCTRL& w_mc) // This must be wrapped in try-catch because on error it throws an exception. // Possible return values are only 0, in case when len was passed 0, or a positive // >0 value that defines the size of the data that it has sent, that is, in case - // of Live mode, equal to 'blocklen'. - stat = d->ps->core().sendmsg2(buf, blocklen, (w_mc)); + // of Live mode, equal to 'len'. + stat = d->ps->core().sendmsg2(buf, len, (w_mc)); } catch (CUDTException& e) { @@ -1605,7 +1603,7 @@ int CUDTGroup::sendBroadcast(const char* buf, int len, SRT_MSGCTRL& w_mc) // NOTE: m_GroupLock is continuously locked - you can safely use Sendstate::it field. for (vector::iterator is = sendstates.begin(); is != sendstates.end(); ++is) { - if (is->stat == blocklen) + if (is->stat == len) { // Successful. successful.push_back(is->mb);