Skip to content

Commit

Permalink
[core] Improved some logs for the no room issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
gou4shi1 authored and maxsharabayko committed Sep 27, 2022
1 parent 90bcc64 commit d84ac20
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
13 changes: 9 additions & 4 deletions srtcore/buffer_rcv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1004,12 +1004,18 @@ void CRcvBufferNew::updateTsbPdTimeBase(uint32_t usPktTimestamp)
m_tsbpd.updateTsbPdTimeBase(usPktTimestamp);
}

string CRcvBufferNew::strFullnessState(int iFirstUnackSeqNo, const time_point& tsNow) const
string CRcvBufferNew::strFullnessState(bool enable_debug_log, int iFirstUnackSeqNo, const time_point& tsNow) const
{
stringstream ss;

ss << "Space avail " << getAvailSize(iFirstUnackSeqNo) << "/" << m_szSize;
ss << " pkts. ";
if (enable_debug_log)
{
ss << "iFirstUnackSeqNo=" << iFirstUnackSeqNo << " m_iStartSeqNo=" << m_iStartSeqNo
<< " m_iStartPos=" << m_iStartPos << " m_iMaxPosInc=" << m_iMaxPosInc << ". ";
}

ss << "Space avail " << getAvailSize(iFirstUnackSeqNo) << "/" << m_szSize << " pkts. ";

if (m_tsbpd.isEnabled() && m_iMaxPosInc > 0)
{
const PacketInfo nextValidPkt = getFirstValidPacketInfo();
Expand All @@ -1030,7 +1036,6 @@ string CRcvBufferNew::strFullnessState(int iFirstUnackSeqNo, const time_point& t
{
ss << "n/a";
}

ss << "). ";
}

Expand Down
2 changes: 1 addition & 1 deletion srtcore/buffer_rcv.h
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ class CRcvBufferNew

/// Form a string of the current buffer fullness state.
/// number of packets acknowledged, TSBPD readiness, etc.
std::string strFullnessState(int iFirstUnackSeqNo, const time_point& tsNow) const;
std::string strFullnessState(bool enable_debug_log, int iFirstUnackSeqNo, const time_point& tsNow) const;

private:
CTsbpdTime m_tsbpd;
Expand Down
23 changes: 15 additions & 8 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7723,9 +7723,15 @@ void srt::CUDT::releaseSynch()
void srt::CUDT::ackDataUpTo(int32_t ack)
{
const int acksize SRT_ATR_UNUSED = CSeqNo::seqoff(m_iRcvLastSkipAck, ack);

HLOGC(xtlog.Debug, log << "ackDataUpTo: %" << m_iRcvLastSkipAck << " -> %" << ack
<< " (" << acksize << " packets)");
if (acksize < 0)
{
LOGC(xtlog.Error,
log << CONID() << " ackDataUpTo: IPE: invalid ACK from %" << m_iRcvLastSkipAck << " to %" << ack << " ("
<< acksize << " packets)");
return;
}
HLOGC(xtlog.Debug,
log << "ackDataUpTo: %" << m_iRcvLastSkipAck << " -> %" << ack << " (" << acksize << " packets)");

m_iRcvLastAck = ack;
m_iRcvLastSkipAck = ack;
Expand Down Expand Up @@ -10130,10 +10136,11 @@ int srt::CUDT::processData(CUnit* in_unit)
else
{
#if ENABLE_NEW_RCVBUFFER
LOGC(qrlog.Warn, log << CONID() << "No room to store incoming packet seqno " << rpkt.m_iSeqNo
<< ", insert offset " << offset << ". "
<< m_pRcvBuffer->strFullnessState(m_iRcvLastAck, steady_clock::now())
);
LOGC(qrlog.Warn,
log << CONID() << "No room to store incoming packet seqno " << rpkt.m_iSeqNo
<< ", insert offset " << offset << ". "
<< m_pRcvBuffer->strFullnessState(
qrlog.Debug.CheckEnabled(), m_iRcvLastSkipAck, steady_clock::now()));
#else
LOGC(qrlog.Warn, log << CONID() << "No room to store incoming packet seqno " << rpkt.m_iSeqNo
<< ", insert offset " << offset << ". "
Expand Down Expand Up @@ -10706,7 +10713,7 @@ void srt::CUDT::dropFromLossLists(int32_t from, int32_t to)
ScopedLock lg(m_RcvLossLock);
m_pRcvLossList->remove(from, to);

HLOGF(qrlog.Debug, "%sTLPKTDROP seq %d-%d (%d packets)", CONID().c_str(), from, to, CSeqNo::seqoff(from, to));
HLOGF(qrlog.Debug, "%sTLPKTDROP seq %d-%d (%d packets)", CONID().c_str(), from, to, CSeqNo::seqlen(from, to));

if (m_bPeerRexmitFlag == 0 || m_iReorderTolerance == 0)
return;
Expand Down

0 comments on commit d84ac20

Please sign in to comment.