-
Notifications
You must be signed in to change notification settings - Fork 866
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] Both readData() consider msgttl #2068
[core] Both readData() consider msgttl #2068
Conversation
related to #2064, if you need the full log, I can prepare one for you :) |
This comment has been minimized.
This comment has been minimized.
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.
So the proposal is to not allow to drop a message on the sender side if TTL is provided and is not yet expired?
I think the proposal is not quite correct.
checkNeedDrop(..)
checks the whole SND buffer for too old messages to drop. using the buffer timespan.
The TTL of the currently submitted message must be specific to that message, not the whole buffer.
Whether the packet is going to be dropped on the sender side, this is currently controlled by |
This PR only add a new place to drop msg.
You are right, this PR is not correct if one socket meet different TTL.
Not totally, |
The problem I want to solve is that, I have specify my message with TTL=200ms, but the congestion control send it after 1s or more (the network is bad at that time), as a result, there are more and more expired messages stuck in send buffer and sent after TTL. |
The TTL value you set on the message is stored in the sender buffer. The value is checked once a packet is read from the buffer. if ((p->m_iTTL >= 0) && (count_milliseconds(steady_clock::now() - p->m_tsOriginTime) > p->m_iTTL)) However, this check is only applied on a packet to be retransmitted. The function I would recommend adding the TTL check to |
@maxsharabayko Thanks for your suggestion, however, I meet some problems when trying to implement you proposal: Question 1: Dropping in Question 2: what is the difference between |
@gou4shi1 Right, it turned out a bit trickier. Here is a patch of roughly how I would expect it to work. The function CSndBuffer::readData. Click to expand/collapse
int CSndBuffer::readData(srt::CPacket& w_packet, steady_clock::time_point& w_srctime, int kflgs, int& w_seqnoinc)
{
int readlen = 0;
w_seqnoinc = 0;
while (m_pCurrBlock != m_pLastBlock)
{
// Make the packet REFLECT the data stored in the buffer.
w_packet.m_pcData = m_pCurrBlock->m_pcData;
readlen = m_pCurrBlock->m_iLength;
w_packet.setLength(readlen);
w_packet.m_iSeqNo = m_pCurrBlock->m_iSeqNo;
if (kflgs == -1)
{
readlen = 0;
}
else
{
m_pCurrBlock->m_iMsgNoBitset |= MSGNO_ENCKEYSPEC::wrap(kflgs);
}
Block* p = m_pCurrBlock;
w_packet.m_iMsgNo = m_pCurrBlock->m_iMsgNoBitset;
w_srctime = getSourceTime(*m_pCurrBlock);
m_pCurrBlock = m_pCurrBlock->m_pNext;
if ((p->m_iTTL >= 0) && (count_milliseconds(steady_clock::now() - p->m_tsOriginTime) > p->m_iTTL))
{
// Skip this packet due to TTL expiry.
readlen = 0;
++w_seqnoinc;
continue;
}
HLOGC(bslog.Debug, log << CONID() << "CSndBuffer: extracting packet size=" << readlen << " to send");
break;
}
return readlen;
} Changes to // ...
kflg = m_pCryptoControl->getSndCryptoFlags();
+ int pktskipseqno = 0;
payload = m_pSndBuffer->readData((w_packet), (origintime), kflg, pktskipseqno);
+ if (pktskipseqno)
+ {
+ // Some packets were skipped due to TTL expiry.
+ m_iSndCurrSeqNo = CSeqNo::incseq(m_iSndCurrSeqNo, pktskipseqno);
+ } In this case, sender would skip the message, then the receiver would notice that send NAK report, and this time the sender would send the message drop request. |
The solution above also notifies the receiver about this drop. So, yes.
The main reason is the logic of the SND buffer. It is expected to work as a FIFO for original packets. If you would just drop a packet before adding it to the buffer, you would know about the drop on the sender side, but no way to communicate this drop to the receiver. The receiver must see a gap in packet sequence to properly handle this situation. |
Great! I would have a test ASAP.
Oops, my typo, lol... |
d27715f
to
19b5d52
Compare
test result looks fine :) |
23df226
to
2447d98
Compare
TODO:
|
Co-authored-by: Maxim Sharabayko <maxlovic@gmail.com>
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.
An update on this PR.
Changes in SRT behavior have been approved at an internal meeting.
This PR will go together with #2185 (not earlier than after November 22), which also adjusts timestamp usage by the sender.
I found that in message mode, messages are often sent after TTL due to congestion control.