diff --git a/srtcore/core.cpp b/srtcore/core.cpp index 5b8358737..5a38ecafc 100644 --- a/srtcore/core.cpp +++ b/srtcore/core.cpp @@ -5395,8 +5395,6 @@ bool CUDT::close() sendCtrl(UMSG_SHUTDOWN); } - m_pCryptoControl->close(); - // Store current connection information. CInfoBlock ib; ib.m_iIPversion = m_PeerAddr.family(); @@ -5408,6 +5406,9 @@ bool CUDT::close() m_bConnected = false; } + if (m_pCryptoControl) + m_pCryptoControl->close(); + if (m_bTsbPd && !pthread_equal(m_RcvTsbPdThread, pthread_t())) { HLOGC(mglog.Debug, log << "CLOSING, joining TSBPD thread...");