Skip to content

Commit

Permalink
[core] CUnitQueue: get size and capacity
Browse files Browse the repository at this point in the history
  • Loading branch information
maxsharabayko committed Jun 9, 2020
1 parent 49f5ec6 commit 78b5fcf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion srtcore/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ int CUnitQueue::increase()
char * tempb = NULL;

// all queues have the same size
int size = m_pQEntry->m_iSize;
const int size = m_pQEntry->m_iSize;

try
{
Expand Down
8 changes: 6 additions & 2 deletions srtcore/queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ class CUnitQueue

int shrink();

public:
int size() const { return m_iSize - m_iCount; }
int capacity() const { return m_iSize; }

public: // Operations on units

/// find an available unit for incoming packet.
Expand Down Expand Up @@ -131,9 +135,9 @@ class CUnitQueue
CUnit* m_pAvailUnit; // recent available unit

int m_iSize; // total size of the unit queue, in number of packets
int m_iCount; // total number of valid packets in the queue
int m_iCount; // total number of valid (occupied) packets in the queue

int m_iMSS; // unit buffer size
int m_iMSS; // unit buffer size
int m_iIPversion; // IP version

private:
Expand Down

0 comments on commit 78b5fcf

Please sign in to comment.