Skip to content

Commit

Permalink
[core] Added SRT_ATTR_GUARDED_BY to some members of CUDT.
Browse files Browse the repository at this point in the history
Imported from Haivision#1859.

Co-authored-by:  Mikolaj Malecki <ethouris@gmail.com>
  • Loading branch information
maxsharabayko and ethouris committed Aug 17, 2021
1 parent 15b72df commit a453ab3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions srtcore/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ class CUDT
sync::atomic<bool> m_bPeerHealth; // If the peer status is normal
sync::atomic<int> m_RejectReason;
bool m_bOpened; // If the UDT entity has been opened
sync::atomic<int> m_iBrokenCounter; // A counter (number of GC checks) to let the GC tag this socket as disconnected
sync::atomic<int> m_iBrokenCounter; // A counter (number of GC checks) to let the GC tag this socket as disconnected

int m_iEXPCount; // Expiration counter
sync::atomic<int> m_iBandwidth; // Estimated bandwidth, number of packets per second
Expand Down Expand Up @@ -773,6 +773,7 @@ class CUDT

atomic_duration m_tdSendTimeDiff; // Aggregate difference in inter-packet sending time

SRT_ATTR_GUARDED_BY(m_RecvAckLock)
sync::atomic<int> m_iFlowWindowSize; // Flow control window size
double m_dCongestionWindow; // Congestion window size

Expand All @@ -782,6 +783,7 @@ class CUDT

duration m_tdACKInterval; // ACK interval
duration m_tdNAKInterval; // NAK interval
SRT_ATTR_GUARDED_BY(m_RecvAckLock)
atomic_time_point m_tsLastRspTime; // Timestamp of last response from the peer
time_point m_tsLastRspAckTime; // Timestamp of last ACK from the peer
atomic_time_point m_tsLastSndTime; // Timestamp of last data/ctrl sent (in system ticks)
Expand All @@ -799,6 +801,7 @@ class CUDT
time_point m_tsNextSendTime; // Scheduled time of next packet sending

sync::atomic<int32_t> m_iSndLastFullAck; // Last full ACK received
SRT_ATTR_GUARDED_BY(m_RecvAckLock)
sync::atomic<int32_t> m_iSndLastAck; // Last ACK received

// NOTE: m_iSndLastDataAck is the value strictly bound to the CSndBufer object (m_pSndBuffer)
Expand All @@ -809,9 +812,9 @@ class CUDT
// to the sending buffer. This way, extraction of an old packet for retransmission should
// require only the lost sequence number, and how to find the packet with this sequence
// will be up to the sending buffer.
sync::atomic<int32_t> m_iSndLastDataAck;// The real last ACK that updates the sender buffer and loss list
sync::atomic<int32_t> m_iSndCurrSeqNo; // The largest sequence number that HAS BEEN SENT
sync::atomic<int32_t> m_iSndNextSeqNo; // The sequence number predicted to be placed at the currently scheduled packet
sync::atomic<int32_t> m_iSndLastDataAck; // The real last ACK that updates the sender buffer and loss list
sync::atomic<int32_t> m_iSndCurrSeqNo; // The largest sequence number that HAS BEEN SENT
sync::atomic<int32_t> m_iSndNextSeqNo; // The sequence number predicted to be placed at the currently scheduled packet

// Note important differences between Curr and Next fields:
// - m_iSndCurrSeqNo: this is used by SRT:SndQ:worker thread and it's operated from CUDT::packData
Expand Down Expand Up @@ -853,6 +856,8 @@ class CUDT
bool m_bPeerTLPktDrop; // Enable sender late packet dropping
bool m_bPeerNakReport; // Sender's peer (receiver) issues Periodic NAK Reports
bool m_bPeerRexmitFlag; // Receiver supports rexmit flag in payload packets

SRT_ATTR_GUARDED_BY(m_RecvAckLock)
int32_t m_iReXmitCount; // Re-Transmit Count since last ACK

private: // Receiving related data
Expand Down

0 comments on commit a453ab3

Please sign in to comment.