Skip to content

Commit

Permalink
[core] Fixed DROPREQ on NAK behind SndLastDataAck (#2011)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko authored May 19, 2021
1 parent 393a6c7 commit 117f831
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions srtcore/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void CSndBuffer::addBuffer(const char* data, int len, SRT_MSGCTRL& w_mctrl)
int32_t& w_msgno = w_mctrl.msgno;
int32_t& w_seqno = w_mctrl.pktseq;
int64_t& w_srctime = w_mctrl.srctime;
int& w_ttl = w_mctrl.msgttl;
const int& ttl = w_mctrl.msgttl;
int size = len / m_iMSS;
if ((len % m_iMSS) != 0)
size++;
Expand Down Expand Up @@ -254,7 +254,7 @@ void CSndBuffer::addBuffer(const char* data, int len, SRT_MSGCTRL& w_mctrl)
s->m_llSourceTime_us = w_srctime;
s->m_tsOriginTime = time;
s->m_tsRexmitTime = time_point();
s->m_iTTL = w_ttl;
s->m_iTTL = ttl;
// Rewrite the actual sending time back into w_srctime
// so that the calling facilities can reuse it
if (!w_srctime)
Expand Down Expand Up @@ -542,6 +542,7 @@ int CSndBuffer::readData(const int offset, CPacket& w_packet, steady_clock::time
// if found block is stale
// (This is for messages that have declared TTL - messages that fail to be sent
// before the TTL defined time comes, will be dropped).

if ((p->m_iTTL >= 0) && (count_milliseconds(steady_clock::now() - p->m_tsOriginTime) > p->m_iTTL))
{
int32_t msgno = p->getMsgSeq();
Expand Down
8 changes: 5 additions & 3 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8848,9 +8848,11 @@ int CUDT::packLostData(CPacket& w_packet, steady_clock::time_point& w_origintime
// No matter whether this is right or not (maybe the attack case should be
// considered, and some LOSSREPORT flood prevention), send the drop request
// to the peer.
int32_t seqpair[2];
seqpair[0] = w_packet.m_iSeqNo;
seqpair[1] = m_iSndLastDataAck;
int32_t seqpair[2] = {
w_packet.m_iSeqNo,
CSeqNo::decseq(m_iSndLastDataAck)
};
w_packet.m_iMsgNo = 0; // Message number is not known, setting all 32 bits to 0.

HLOGC(qrlog.Debug, log << "PEER reported LOSS not from the sending buffer - requesting DROP: "
<< "msg=" << MSGNO_SEQ::unwrap(w_packet.m_iMsgNo) << " SEQ:"
Expand Down
2 changes: 1 addition & 1 deletion srtcore/srt.h
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ SRT_API int srt_setsockflag (SRTSOCKET u, SRT_SOCKOPT opt, const void* op
typedef struct SRT_MsgCtrl_
{
int flags; // Left for future
int msgttl; // TTL for a message, default -1 (no TTL limitation)
int msgttl; // TTL for a message (millisec), default -1 (no TTL limitation)
int inorder; // Whether a message is allowed to supersede partially lost one. Unused in stream and live mode.
int boundary; // 0:mid pkt, 1(01b):end of frame, 2(11b):complete frame, 3(10b): start of frame
int64_t srctime; // source time since epoch (usec), 0: use internal time (sender)
Expand Down

0 comments on commit 117f831

Please sign in to comment.