Skip to content

Commit

Permalink
[core] Fixed broadcast group: cut failed links on partial sending suc…
Browse files Browse the repository at this point in the history
…cess
  • Loading branch information
Mikolaj Malecki authored and maxsharabayko committed Jul 2, 2024
1 parent 36260c3 commit 5e6e80b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion srtcore/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,10 @@ int CUDTGroup::sendBroadcast(const char* buf, int len, SRT_MSGCTRL& w_mc)

int ercode = 0;

if (was_blocked)
// This block causes waiting for any socket to accept the payload.
// This should be done only in blocking mode and only if no other socket
// accepted the payload.
if (was_blocked && none_succeeded && m_bSynSending)
{
m_Global.m_EPoll.update_events(id(), m_sPollID, SRT_EPOLL_OUT, false);
if (!m_bSynSending)
Expand Down Expand Up @@ -1648,6 +1651,19 @@ int CUDTGroup::sendBroadcast(const char* buf, int len, SRT_MSGCTRL& w_mc)
throw CUDTException(major, minor, 0);
}

for (vector<Sendstate>::iterator is = sendstates.begin(); is != sendstates.end(); ++is)
{
// Here we have a situation that at least 1 link successfully sent a packet.
// All links for which sending has failed must be closed.
if (is->stat == -1)
{
// This only sets the state to the socket; the GC process should
// pick it up at the next time.
HLOGC(gslog.Debug, log << "grp/sendBroadcast: per PARTIAL SUCCESS, closing failed @" << is->id);
is->mb->ps->setBrokenClosed();
}
}

// Now that at least one link has succeeded, update sending stats.
m_stats.sent.count(len);

Expand Down

0 comments on commit 5e6e80b

Please sign in to comment.