Skip to content

Commit

Permalink
[core] Fix sendBroadcast() message length (#2391).
Browse files Browse the repository at this point in the history
The number of blocked member links was submitted instead of the buffer length.
  • Loading branch information
gou4shi1 authored Jun 23, 2022
1 parent c5f613e commit cdafca5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions srtcore/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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)
{
Expand All @@ -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<Sendstate>::iterator is = sendstates.begin(); is != sendstates.end(); ++is)
{
if (is->stat == blocklen)
if (is->stat == len)
{
// Successful.
successful.push_back(is->mb);
Expand Down

0 comments on commit cdafca5

Please sign in to comment.