diff --git a/srtcore/api.cpp b/srtcore/api.cpp index 665593c39..7eda3f2bf 100644 --- a/srtcore/api.cpp +++ b/srtcore/api.cpp @@ -236,6 +236,8 @@ string srt::CUDTUnited::CONID(SRTSOCKET sock) int srt::CUDTUnited::startup() { ScopedLock gcinit(m_InitLock); + if (m_bGCStatus) + return 1; if (m_iInstanceCount++ > 0) return 1; @@ -254,9 +256,6 @@ int srt::CUDTUnited::startup() PacketFilter::globalInit(); - if (m_bGCStatus) - return 1; - m_bClosing = false; if (!StartThread(m_GCThread, garbageCollect, this, "SRT:GC")) @@ -3390,8 +3389,7 @@ int srt::CUDT::cleanup() SRTSOCKET srt::CUDT::socket() { - if (!uglobal().m_bGCStatus) - uglobal().startup(); + uglobal().startup(); try { @@ -3441,8 +3439,7 @@ srt::CUDTGroup& srt::CUDT::newGroup(const int type) SRTSOCKET srt::CUDT::createGroup(SRT_GROUP_TYPE gt) { // Doing the same lazy-startup as with srt_create_socket() - if (!uglobal().m_bGCStatus) - uglobal().startup(); + uglobal().startup(); try {