Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Fixed broadcast group: cut failed links on partial sending success #2966

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading