Skip to content

Commit

Permalink
Restored split else-if
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikołaj Małecki committed Sep 4, 2024
1 parent 6105941 commit 89259ba
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions srtcore/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7948,30 +7948,27 @@ void srt::CUDT::sendCtrl(UDTMessageType pkttype, const int32_t* lparam, void* rp
leaveCS(m_StatsLock);
}
// Call with no arguments - get loss list from internal data.
else
else if (m_pRcvLossList->getLossLength() > 0)
{
if (m_pRcvLossList->getLossLength() > 0)
{
// this is periodically NAK report; make sure NAK cannot be sent back too often

// read loss list from the local receiver loss list
int32_t *data = new int32_t[m_iMaxSRTPayloadSize / 4];
int losslen;
m_pRcvLossList->getLossArray(data, losslen, m_iMaxSRTPayloadSize / 4);
// this is periodically NAK report; make sure NAK cannot be sent back too often

if (0 < losslen)
{
ctrlpkt.pack(pkttype, NULL, data, losslen * 4);
ctrlpkt.set_id(m_PeerID);
nbsent = m_pSndQueue->sendto(m_PeerAddr, ctrlpkt, m_SourceAddr);
// read loss list from the local receiver loss list
int32_t *data = new int32_t[m_iMaxSRTPayloadSize / 4];
int losslen;
m_pRcvLossList->getLossArray(data, losslen, m_iMaxSRTPayloadSize / 4);

enterCS(m_StatsLock);
m_stats.rcvr.sentNak.count(1);
leaveCS(m_StatsLock);
}
if (0 < losslen)
{
ctrlpkt.pack(pkttype, NULL, data, losslen * 4);
ctrlpkt.set_id(m_PeerID);
nbsent = m_pSndQueue->sendto(m_PeerAddr, ctrlpkt, m_SourceAddr);

delete[] data;
enterCS(m_StatsLock);
m_stats.rcvr.sentNak.count(1);
leaveCS(m_StatsLock);
}

delete[] data;
}

// update next NAK time, which should wait enough time for the retansmission, but not too long
Expand Down

0 comments on commit 89259ba

Please sign in to comment.