Skip to content

Commit

Permalink
[core] RCV don't drop packets on SND drop request
Browse files Browse the repository at this point in the history
if they already exist in the buffer and can be read (full message is available).
  • Loading branch information
maxsharabayko committed Feb 21, 2022
1 parent 81a31da commit 5adc2db
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions srtcore/buffer_rcv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ int CRcvBufferNew::dropMessage(int32_t seqnolo, int32_t seqnohi, int32_t msgno)
if (!m_entries[i].pUnit)
continue;

// TODO: Break the loop if a massege has been found. No need to search further.
const int32_t msgseq = m_entries[i].pUnit->m_Packet.getMsgSeq(m_bPeerRexmitFlag);
if (msgseq == msgno)
{
Expand Down Expand Up @@ -261,6 +262,11 @@ int CRcvBufferNew::dropMessage(int32_t seqnolo, int32_t seqnohi, int32_t msgno)
int iDropCnt = 0;
for (int i = incPos(m_iStartPos, start_off); i != end_pos && i != last_pos; i = incPos(i))
{
// Don't drop messages, if all its packets are already in the buffer.
// TODO: Don't drop a several-packet message if all packets are in the buffer.
if (m_entries[i].pUnit && m_entries[i].pUnit->m_Packet.getMsgBoundary() == PB_SOLO)
continue;

dropUnitInPos(i);
++iDropCnt;
m_entries[i].status = EntryState_Drop;
Expand Down

0 comments on commit 5adc2db

Please sign in to comment.