Skip to content

Commit bc2f48e

Browse files
ethouris-hvmaxsharabayko
authored andcommitted
[core] Put the use of m_bGCStatus under m_InitLock
1 parent 84d18ec commit bc2f48e

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

‎srtcore/api.cpp‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ string srt::CUDTUnited::CONID(SRTSOCKET sock)
236236
int srt::CUDTUnited::startup()
237237
{
238238
ScopedLock gcinit(m_InitLock);
239+
if (m_bGCStatus)
240+
return 1;
239241

240242
if (m_iInstanceCount++ > 0)
241243
return 1;
@@ -254,9 +256,6 @@ int srt::CUDTUnited::startup()
254256

255257
PacketFilter::globalInit();
256258

257-
if (m_bGCStatus)
258-
return 1;
259-
260259
m_bClosing = false;
261260

262261
if (!StartThread(m_GCThread, garbageCollect, this, "SRT:GC"))
@@ -3390,8 +3389,7 @@ int srt::CUDT::cleanup()
33903389

33913390
SRTSOCKET srt::CUDT::socket()
33923391
{
3393-
if (!uglobal().m_bGCStatus)
3394-
uglobal().startup();
3392+
uglobal().startup();
33953393

33963394
try
33973395
{
@@ -3441,8 +3439,7 @@ srt::CUDTGroup& srt::CUDT::newGroup(const int type)
34413439
SRTSOCKET srt::CUDT::createGroup(SRT_GROUP_TYPE gt)
34423440
{
34433441
// Doing the same lazy-startup as with srt_create_socket()
3444-
if (!uglobal().m_bGCStatus)
3445-
uglobal().startup();
3442+
uglobal().startup();
34463443

34473444
try
34483445
{

0 commit comments

Comments
 (0)