Skip to content

Commit

Permalink
[core] Added restrictions on pktseq/msgno fields in srt_sendmsg2 call (
Browse files Browse the repository at this point in the history
  • Loading branch information
ethouris authored Mar 23, 2021
1 parent 631a976 commit 22d5736
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6288,10 +6288,17 @@ int CUDT::sendmsg2(const char *data, int len, SRT_MSGCTRL& w_mctrl)
IF_HEAVY_LOGGING(steady_clock::time_point ts_srctime =
steady_clock::time_point() + microseconds_from(w_mctrl.srctime));

#if ENABLE_EXPERIMENTAL_BONDING
// Check if seqno has been set, in case when this is a group sender.
// If the sequence is from the past towards the "next sequence",
// simply return the size, pretending that it has been sent.
if (w_mctrl.pktseq != SRT_SEQNO_NONE && m_iSndNextSeqNo != SRT_SEQNO_NONE)

// NOTE: it's assumed that if this is a group member, then
// an attempt to call srt_sendmsg2 has been rejected, and so
// the pktseq field has been set by the internal group sender function.
if (m_parent->m_GroupOf
&& w_mctrl.pktseq != SRT_SEQNO_NONE
&& m_iSndNextSeqNo != SRT_SEQNO_NONE)
{
if (CSeqNo::seqcmp(w_mctrl.pktseq, seqno) < 0)
{
Expand All @@ -6300,6 +6307,7 @@ int CUDT::sendmsg2(const char *data, int len, SRT_MSGCTRL& w_mctrl)
return size;
}
}
#endif

// Set this predicted next sequence to the control information.
// It's the sequence of the FIRST (!) packet from all packets used to send
Expand Down

0 comments on commit 22d5736

Please sign in to comment.