Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom release SRT v1.5.3a #2946

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
485d1e9
[core] Fixed wrong pktSndDrop stats value (#2811).
maxsharabayko Oct 18, 2023
0848d61
[core] Fix extra ACK sent after a connection is established (#2832)
yomnes0 Dec 20, 2023
a0fae00
[core] Fixed the RCV buff nonread position update
maxsharabayko Feb 12, 2024
520c843
[core] Fixed the PacketFilter configuration not counting the AEAD AUT…
ethouris Feb 16, 2024
5aabe5d
[core] Added getter for the SRTO_MAXREXMITBW socket option.
maxsharabayko Feb 20, 2024
dd3cb99
[core] Fixed POST options setting on a connected group.
maxsharabayko Feb 22, 2024
9c78343
[core] Fixed SRT_SOCKOPT_NPOST when ENABLE_MAXREXMITBW is defined.
maxsharabayko Feb 22, 2024
ce9f8ab
[core] Fix HaiCrypt_Clone(): set up RX crypto ctx properly (#2905).
funman Apr 4, 2024
4526351
[core] Drop noenc packets if RcvKmState is "secured".
maxsharabayko Apr 9, 2024
883cd4a
[core] Minor connection logging improvement (#2930).
maxsharabayko Apr 19, 2024
6a8b8f8
[core] Fixed stats counting packets dropped by a group (#2934).
maxsharabayko Apr 22, 2024
37a12eb
[core] Stats: do not count discarded packets as dropped (#2932).
maxsharabayko Apr 22, 2024
f22ddf5
[core] Removed group syncing when sending control ACK (#2935).
maxsharabayko Apr 22, 2024
a0883e0
[core] Minor internal logging format changes (#2939).
maxsharabayko Apr 24, 2024
a3b9549
[core] Fixed group RCV drop sequence range log.
maxsharabayko Apr 24, 2024
53ac920
[core] Group set the RCV base seqno using peer ISN.
maxsharabayko Apr 26, 2024
7743058
[docs] Update the SRT_KM_S_SECURED description.
maxsharabayko Apr 9, 2024
8850960
[core] Fixed group recv read-ready check.
maxsharabayko Apr 22, 2024
bb24f25
[core] Fixed time base sync in a group.
maxsharabayko Apr 25, 2024
5fd96c3
[core] Fixed group synchronization of accepted sockets.
maxsharabayko Apr 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/API/API-socket-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Exchange for the initial key is done in the handshake.

- `SRT_KM_S_SECURED` (`2`): KM exchange was successful and the data will be sent
encrypted and will be decrypted by the receiver. This state is only possible on
both sides in both directions simultaneously.
both sides in both directions simultaneously. Any unencrypted packet will be dropped by the receiver.

- `SRT_KM_S_NOSECRET` (`3`): If this state is in the sending direction (`SRTO_SNDKMSTATE`),
then it means that the sending party has set a passphrase, but the peer did not.
Expand Down
6 changes: 4 additions & 2 deletions docs/API/statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ Packets may be dropped conditionally when both `SRTO_TSBPDMODE` and `SRTO_TLPKTD
#### pktRcvUndecryptTotal

The total number of packets that failed to be decrypted at the receiver side. Available for receiver.
The statistic also counts unencrypted packets that were expected to be uncrypted on a secured connection (see [SRTO_KM_S_SECURED](API-socket-options.md#srt_km_state))
and hence dropped as not encrypted (undecrypted).

#### pktSndFilterExtraTotal

Expand Down Expand Up @@ -821,5 +823,5 @@ The ratio of unrecovered by the socket group packets `Dropped Packets Ratio` can

```
Dropped Packets Ratio = pktRcvDropTotal / pktSentUniqueTotal; in case both sender and receiver statistics is available
Dropped Packets Ratio = pktRcvDropTotal / (pktRecvUniqueTotal + pktRcvDropTotal); in case receiver only statistics is available
```
Dropped Packets Ratio = pktRcvDropTotal / (pktRecvUniqueTotal + pktRcvDropTotal); in case receiver only statistics is available
```
1 change: 1 addition & 0 deletions haicrypt/hcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ int HaiCrypt_Clone(HaiCrypt_Handle hhcSrc, HaiCrypt_CryptoDir tx, HaiCrypt_Handl
cryptoClone->ctx_pair[1].flags &= ~HCRYPT_CTX_F_ENCRYPT;
memset(cryptoClone->ctx_pair[0].salt, 0, sizeof(cryptoClone->ctx_pair[0].salt));
cryptoClone->ctx_pair[0].salt_len = 0;
cryptoClone->ctx = &cryptoClone->ctx_pair[0];
}

*phhc = (void *)cryptoClone;
Expand Down
3 changes: 3 additions & 0 deletions srtcore/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,9 @@ int srt::CUDTUnited::newConnection(const SRTSOCKET listen,
HLOGC(cnlog.Debug, log << "newConnection: mapping peer " << ns->m_PeerID
<< " to that socket (" << ns->m_SocketID << ")");
m_PeerRec[ns->getPeerSpec()].insert(ns->m_SocketID);

LOGC(cnlog.Note, log << "@" << ns->m_SocketID << " connection on listener @" << listen
<< " (" << ns->m_SelfAddr.str() << ") from peer @" << ns->m_PeerID << " (" << peer.str() << ")");
}
catch (...)
{
Expand Down
20 changes: 14 additions & 6 deletions srtcore/buffer_rcv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ int CRcvBuffer::insert(CUnit* unit)
return 0;
}

int CRcvBuffer::dropUpTo(int32_t seqno)
std::pair<int, int> CRcvBuffer::dropUpTo(int32_t seqno)
{
IF_RCVBUF_DEBUG(ScopedLog scoped_log);
IF_RCVBUF_DEBUG(scoped_log.ss << "CRcvBuffer::dropUpTo: seqno " << seqno << " m_iStartSeqNo " << m_iStartSeqNo);
Expand All @@ -215,16 +215,23 @@ int CRcvBuffer::dropUpTo(int32_t seqno)
if (len <= 0)
{
IF_RCVBUF_DEBUG(scoped_log.ss << ". Nothing to drop.");
return 0;
return std::make_pair(0, 0);
}

m_iMaxPosOff -= len;
if (m_iMaxPosOff < 0)
m_iMaxPosOff = 0;

const int iDropCnt = len;
int iNumDropped = 0; // Number of dropped packets that were missing.
int iNumDiscarded = 0; // The number of dropped packets that existed in the buffer.
while (len > 0)
{
// Note! Dropping a EntryState_Read must not be counted as a drop because it was read.
// Note! Dropping a EntryState_Drop must not be counted as a drop because it was already dropped and counted earlier.
if (m_entries[m_iStartPos].status == EntryState_Avail)
++iNumDiscarded;
else if (m_entries[m_iStartPos].status == EntryState_Empty)
++iNumDropped;
dropUnitInPos(m_iStartPos);
m_entries[m_iStartPos].status = EntryState_Empty;
SRT_ASSERT(m_entries[m_iStartPos].pUnit == NULL && m_entries[m_iStartPos].status == EntryState_Empty);
Expand All @@ -239,14 +246,14 @@ int CRcvBuffer::dropUpTo(int32_t seqno)

// If the nonread position is now behind the starting position, set it to the starting position and update.
// Preceding packets were likely missing, and the non read position can probably be moved further now.
if (CSeqNo::seqcmp(m_iFirstNonreadPos, m_iStartPos) < 0)
if (!isInRange(m_iStartPos, m_iMaxPosOff, m_szSize, m_iFirstNonreadPos))
{
m_iFirstNonreadPos = m_iStartPos;
updateNonreadPos();
}
if (!m_tsbpd.isEnabled() && m_bMessageAPI)
updateFirstReadableOutOfOrder();
return iDropCnt;
return std::make_pair(iNumDropped, iNumDiscarded);
}

int CRcvBuffer::dropAll()
Expand All @@ -255,7 +262,8 @@ int CRcvBuffer::dropAll()
return 0;

const int end_seqno = CSeqNo::incseq(m_iStartSeqNo, m_iMaxPosOff);
return dropUpTo(end_seqno);
const std::pair<int, int> numDropped = dropUpTo(end_seqno);
return numDropped.first + numDropped.second;
}

int CRcvBuffer::dropMessage(int32_t seqnolo, int32_t seqnohi, int32_t msgno, DropActionIfExists actionOnExisting)
Expand Down
31 changes: 25 additions & 6 deletions srtcore/buffer_rcv.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class CRcvBuffer

/// Drop packets in the receiver buffer from the current position up to the seqno (excluding seqno).
/// @param [in] seqno drop units up to this sequence number
/// @return number of dropped packets.
int dropUpTo(int32_t seqno);
/// @return number of dropped (missing) and discarded (available) packets as a pair(dropped, discarded).
std::pair<int, int> dropUpTo(int32_t seqno);

/// @brief Drop all the packets in the receiver buffer.
/// The starting position and seqno are shifted right after the last packet in the buffer.
Expand Down Expand Up @@ -200,6 +200,20 @@ class CRcvBuffer
return (m_iMaxPosOff == 0);
}

/// Returns the currently used number of cells, including
/// gaps with empty cells, or in other words, the distance
/// between the initial position and the youngest received packet.
size_t size() const
{
return m_iMaxPosOff;
}

// Returns true if the buffer is full. Requires locking.
bool full() const
{
return size() == capacity();
}

/// Return buffer capacity.
/// One slot had to be empty in order to tell the difference between "empty buffer" and "full buffer".
/// E.g. m_iFirstNonreadPos would again point to m_iStartPos if m_szSize entries are added continiously.
Expand Down Expand Up @@ -239,9 +253,15 @@ class CRcvBuffer
inline int incPos(int pos, int inc = 1) const { return (pos + inc) % m_szSize; }
inline int decPos(int pos) const { return (pos - 1) >= 0 ? (pos - 1) : int(m_szSize - 1); }
inline int offPos(int pos1, int pos2) const { return (pos2 >= pos1) ? (pos2 - pos1) : int(m_szSize + pos2 - pos1); }

/// @brief Compares the two positions in the receiver buffer relative to the starting position.
/// @param pos2 a position in the receiver buffer.
/// @param pos1 a position in the receiver buffer.
/// @return a positive value if pos2 is ahead of pos1; a negative value, if pos2 is behind pos1; otherwise returns 0.
inline int cmpPos(int pos2, int pos1) const
{
// XXX maybe not the best implementation, but this keeps up to the rule
// XXX maybe not the best implementation, but this keeps up to the rule.
// Maybe use m_iMaxPosOff to ensure a position is not behind the m_iStartPos.
const int off1 = pos1 >= m_iStartPos ? pos1 - m_iStartPos : pos1 + (int)m_szSize - m_iStartPos;
const int off2 = pos2 >= m_iStartPos ? pos2 - m_iStartPos : pos2 + (int)m_szSize - m_iStartPos;

Expand Down Expand Up @@ -327,9 +347,8 @@ class CRcvBuffer
EntryStatus status;
};

//static Entry emptyEntry() { return Entry { NULL, EntryState_Empty }; }

FixedArray<Entry> m_entries;
typedef FixedArray<Entry> entries_t;
entries_t m_entries;

const size_t m_szSize; // size of the array of units (buffer)
CUnitQueue* m_pUnitQueue; // the shared unit queue
Expand Down
Loading