-
Notifications
You must be signed in to change notification settings - Fork 851
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 CRcvBuffer::dropMessage. #2657
[core] Fixed CRcvBuffer::dropMessage. #2657
Conversation
Tell what to do with existing packets. Fixed pkt seqno dropping loop range.
c4a93a3
to
7d98507
Compare
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 = packetAt(i).getMsgSeq(m_bPeerRexmitFlag); | ||
if (msgseq == msgno) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that message numbers are also increasing with rollover. It might be a good idea to check if the message number from the current packet is already PAST the searched message number. If so, there's no point in continuing with the loop because remaining packets in the buffer won't contain this message.
The tricky situation is to drop a message that is ahead of the current RCV buffer position.
After the drop the RCV buffer should be:
|
@@ -310,15 +309,21 @@ int CRcvBuffer::dropMessage(int32_t seqnolo, int32_t seqnohi, int32_t msgno) | |||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- should return
iDropCnt
? - should not skip this part?
const bool needUpdateNonreadPos = (minDroppedOffset != -1 && minDroppedOffset <= getRcvDataSize());
releaseNextFillerEntries();
if (needUpdateNonreadPos)
{
m_iFirstNonreadPos = m_iStartPos;
updateNonreadPos();
}
if (!m_tsbpd.isEnabled() && m_bMessageAPI)
{
if (!checkFirstReadableOutOfOrder())
m_iFirstReadableOutOfOrder = -1;
updateFirstReadableOutOfOrder();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, good catch!
Fixed
CRcvBuffer::dropMessage(..)
.The function is used in two situations:
If msgno is valid, sender has requested to drop the whole message by TTL. In this case it has to also provide a pkt seqno range.
However, if a message has been partially acknowledged and already removed from the SND buffer,
the seqnolo might specify some position in the middle of the message, not the very first packet.
If those packets have been acknowledged, they must exist in the receiver buffer unless already read.
In this case the msgno should be used to determine starting packets of the message.
Some packets of the message can be missing on the receiver, therefore the actual drop should still be performed by pkt seqno range.
If message number is 0 or SRT_MSGNO_NONE, then use sequence numbers to locate sequence range to drop [seqnolo, seqnohi].
A SOLO message packet can be kept depending on actionOnExisting value.
This is done to avoid dropping existing packet when the sender was asked to re-transmit a packet from an outdated loss report, which is already not available in the SND buffer.
Dropping a packet with decryption failure means the existing packet must be dropped.
Dropping a packet by incoming message drop request means the existing packet must be kept, only missing packets or partially missing messages must be dropped.
TODO: