MCPcopy Create free account
hub / github.com/Haivision/srt / postConnect

Method postConnect

srtcore/core.cpp:4973–5204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4971}
4972
4973EConnectStatus srt::CUDT::postConnect(const CPacket* pResponse, bool rendezvous, CUDTException *eout) ATR_NOEXCEPT
4974{
4975 if (m_ConnRes.m_iVersion < HS_VERSION_SRT1)
4976 m_tsRcvPeerStartTime = steady_clock::time_point(); // will be set correctly in SRT HS.
4977
4978 // This procedure isn't being executed in rendezvous because
4979 // in rendezvous it's completed before calling this function.
4980 if (!rendezvous)
4981 {
4982 HLOGC(cnlog.Debug, log << CONID() << boolalpha << "postConnect: packet:" << bool(pResponse) << " rendezvous:" << rendezvous);
4983 // The "local storage depleted" case shouldn't happen here, but
4984 // this is a theoretical path that needs prevention.
4985 bool ok = pResponse;
4986 if (!ok)
4987 {
4988 m_RejectReason = SRT_REJ_IPE;
4989 if (eout)
4990 {
4991 *eout = CUDTException(MJ_SETUP, MN_REJECTED, 0);
4992 }
4993 return CONN_REJECT;
4994 }
4995
4996 // [[assert (pResponse != NULL)]];
4997
4998 // NOTE: THIS function must be called before calling prepareConnectionObjects.
4999 // The reason why it's not part of prepareConnectionObjects is that the activities
5000 // done there are done SIMILAR way in acceptAndRespond, which also calls this
5001 // function. In fact, prepareConnectionObjects() represents the code that was
5002 // done separately in processConnectResponse() and acceptAndRespond(), so this way
5003 // this code is now common. Now acceptAndRespond() does "manually" something similar
5004 // to applyResponseSettings(), just a little bit differently. This SHOULD be made
5005 // common as a part of refactoring job, just needs a bit more time.
5006 //
5007 // Currently just this function must be called always BEFORE prepareConnectionObjects
5008 // everywhere except acceptAndRespond().
5009 ok = applyResponseSettings(pResponse);
5010
5011 // This will actually be done also in rendezvous HSv4,
5012 // however in this case the HSREQ extension will not be attached,
5013 // so it will simply go the "old way".
5014 // (&&: skip if failed already)
5015 // Must be called before interpretSrtHandshake() to create the CryptoControl.
5016 ok = ok && prepareConnectionObjects(m_ConnRes, m_SrtHsSide, eout);
5017
5018 // May happen that 'response' contains a data packet that was sent in rendezvous mode.
5019 // In this situation the interpretation of handshake was already done earlier.
5020 ok = ok && pResponse->isControl();
5021 ok = ok && interpretSrtHandshake(m_ConnRes, *pResponse, 0, 0);
5022 ok = ok && prepareBuffers(eout);
5023
5024 if (!ok)
5025 {
5026 if (eout)
5027 {
5028 *eout = CUDTException(MJ_SETUP, MN_REJECTED, 0);
5029 }
5030 // m_RejectReason already set

Callers

nothing calls this directly

Calls 13

isControlMethod · 0.80
familyMethod · 0.80
locateSocketMethod · 0.80
setNewEntryMethod · 0.80
removeConnectorMethod · 0.80
getSockAddrMethod · 0.80
exp_groupLockMethod · 0.80
setGroupConnectedMethod · 0.80
update_eventsMethod · 0.80
CUDTExceptionClass · 0.70
lookupMethod · 0.45
traceMethod · 0.45

Tested by

no test coverage detected