1
0
forked from 0ad/0ad

Don't create thread on failed connection

Differential revision: D4545
Fixes: #6442

This was SVN commit r26649.
This commit is contained in:
Angen 2022-03-14 17:19:42 +00:00
parent cce1005c81
commit 8cec96270b

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games. /* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D. * This file is part of 0 A.D.
* *
* 0 A.D. is free software: you can redistribute it and/or modify * 0 A.D. is free software: you can redistribute it and/or modify
@ -201,7 +201,8 @@ bool CNetClient::SetupConnection(ENetHost* enetClient)
CNetClientSession* session = new CNetClientSession(*this); CNetClientSession* session = new CNetClientSession(*this);
bool ok = session->Connect(m_ServerAddress, m_ServerPort, enetClient); bool ok = session->Connect(m_ServerAddress, m_ServerPort, enetClient);
SetAndOwnSession(session); SetAndOwnSession(session);
m_PollingThread = std::thread(Threading::HandleExceptions<CNetClientSession::RunNetLoop>::Wrapper, m_Session); if (ok)
m_PollingThread = std::thread(Threading::HandleExceptions<CNetClientSession::RunNetLoop>::Wrapper, m_Session);
return ok; return ok;
} }