Fixed race condition for TCP link deleting.
This could have caused crashes when a client disconnected from the server.
This commit is contained in:
parent
a8953bff26
commit
b474b9fb5d
@ -1892,9 +1892,13 @@ void cClientHandle::Tick(float a_Dt)
|
||||
cCSLock Lock(m_CSOutgoingData);
|
||||
std::swap(OutgoingData, m_OutgoingData);
|
||||
}
|
||||
if ((m_Link != nullptr) && !OutgoingData.empty())
|
||||
if (!OutgoingData.empty())
|
||||
{
|
||||
m_Link->Send(OutgoingData.data(), OutgoingData.size());
|
||||
cTCPLinkPtr Link(m_Link); // Grab a copy of the link in a multithread-safe way
|
||||
if ((Link != nullptr))
|
||||
{
|
||||
Link->Send(OutgoingData.data(), OutgoingData.size());
|
||||
}
|
||||
}
|
||||
|
||||
m_TicksSinceLastPacket += 1;
|
||||
|
Loading…
Reference in New Issue
Block a user