@@ -2414,7 +2414,7 @@ bool srt::CUDT::interpretSrtHandshake(const CHandShake& hs,
2414
2414
}
2415
2415
2416
2416
// We still believe it should work, let's check the flags.
2417
- int ext_flags = SrtHSRequest::SRT_HSTYPE_HSFLAGS::unwrap(hs.m_iType);
2417
+ const int ext_flags = SrtHSRequest::SRT_HSTYPE_HSFLAGS::unwrap(hs.m_iType);
2418
2418
if (ext_flags == 0)
2419
2419
{
2420
2420
m_RejectReason = SRT_REJ_ROGUE;
@@ -4019,15 +4019,16 @@ EConnectStatus srt::CUDT::processRendezvous(
4019
4019
m_ConnReq.m_iReqType = rsp_type;
4020
4020
m_ConnReq.m_extension = needs_extension;
4021
4021
4022
- // This must be done before prepareConnectionObjects().
4022
+ // This must be done before prepareConnectionObjects(), because it sets ISN and m_iMaxSRTPayloadSize needed to create buffers .
4023
4023
if (!applyResponseSettings())
4024
4024
{
4025
4025
LOGC(cnlog.Error, log << "processRendezvous: rogue peer");
4026
4026
return CONN_REJECT;
4027
4027
}
4028
4028
4029
- // This must be done before interpreting and creating HSv5 extensions.
4030
- if (!prepareConnectionObjects(m_ConnRes, m_SrtHsSide, 0))
4029
+ // The CryptoControl must be created by the prepareConnectionObjects() before interpreting and creating HSv5 extensions
4030
+ // because the it will be used there.
4031
+ if (!prepareConnectionObjects(m_ConnRes, m_SrtHsSide, NULL))
4031
4032
{
4032
4033
// m_RejectReason already handled
4033
4034
HLOGC(cnlog.Debug, log << "processRendezvous: rejecting due to problems in prepareConnectionObjects.");
@@ -4536,6 +4537,7 @@ EConnectStatus srt::CUDT::postConnect(const CPacket* pResponse, bool rendezvous,
4536
4537
// however in this case the HSREQ extension will not be attached,
4537
4538
// so it will simply go the "old way".
4538
4539
// (&&: skip if failed already)
4540
+ // Must be called before interpretSrtHandshake() to create the CryptoControl.
4539
4541
ok = ok && prepareConnectionObjects(m_ConnRes, m_SrtHsSide, eout);
4540
4542
4541
4543
// May happen that 'response' contains a data packet that was sent in rendezvous mode.
@@ -5568,11 +5570,8 @@ bool srt::CUDT::prepareConnectionObjects(const CHandShake &hs, HandshakeSide hsd
5568
5570
return true;
5569
5571
}
5570
5572
5571
- bool bidirectional = false;
5572
- if (hs.m_iVersion > HS_VERSION_UDT4)
5573
- {
5574
- bidirectional = true; // HSv5 is always bidirectional
5575
- }
5573
+ // HSv5 is always bidirectional
5574
+ const bool bidirectional = (hs.m_iVersion > HS_VERSION_UDT4);
5576
5575
5577
5576
// HSD_DRAW is received only if this side is listener.
5578
5577
// If this side is caller with HSv5, HSD_INITIATOR should be passed.
@@ -5595,7 +5594,7 @@ bool srt::CUDT::prepareConnectionObjects(const CHandShake &hs, HandshakeSide hsd
5595
5594
m_pSndBuffer = new CSndBuffer(32, m_iMaxSRTPayloadSize);
5596
5595
#if ENABLE_NEW_RCVBUFFER
5597
5596
SRT_ASSERT(m_iISN != -1);
5598
- m_pRcvBuffer = new srt::CRcvBufferNew(m_iISN, m_config.iRcvBufSize, &(m_pRcvQueue->m_UnitQueue), m_bPeerRexmitFlag, m_config.bMessageAPI);
5597
+ m_pRcvBuffer = new srt::CRcvBufferNew(m_iISN, m_config.iRcvBufSize, &(m_pRcvQueue->m_UnitQueue), m_config.bMessageAPI);
5599
5598
#else
5600
5599
m_pRcvBuffer = new CRcvBuffer(&(m_pRcvQueue->m_UnitQueue), m_config.iRcvBufSize);
5601
5600
#endif
@@ -8982,6 +8981,7 @@ void srt::CUDT::updateSrtRcvSettings()
8982
8981
enterCS(m_RecvLock);
8983
8982
#if ENABLE_NEW_RCVBUFFER
8984
8983
m_pRcvBuffer->setTsbPdMode(m_tsRcvPeerStartTime, false, milliseconds_from(m_iTsbPdDelay_ms));
8984
+ m_pRcvBuffer->setPeerRexmitFlag(m_bPeerRexmitFlag);
8985
8985
#else
8986
8986
m_pRcvBuffer->setRcvTsbPdMode(m_tsRcvPeerStartTime, milliseconds_from(m_iTsbPdDelay_ms));
8987
8987
#endif
0 commit comments