summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-02-22 19:05:43 +0100
committerMattes D <github@xoft.cz>2015-02-22 19:06:04 +0100
commitb474b9fb5d95f3c511ce0f01f4a6c3e205f13629 (patch)
tree17096015935d67ba3ed6de278abb19d3b446558c /src/ClientHandle.cpp
parentMerge pull request #1760 from Samvbnm/patch-1 (diff)
downloadcuberite-b474b9fb5d95f3c511ce0f01f4a6c3e205f13629.tar
cuberite-b474b9fb5d95f3c511ce0f01f4a6c3e205f13629.tar.gz
cuberite-b474b9fb5d95f3c511ce0f01f4a6c3e205f13629.tar.bz2
cuberite-b474b9fb5d95f3c511ce0f01f4a6c3e205f13629.tar.lz
cuberite-b474b9fb5d95f3c511ce0f01f4a6c3e205f13629.tar.xz
cuberite-b474b9fb5d95f3c511ce0f01f4a6c3e205f13629.tar.zst
cuberite-b474b9fb5d95f3c511ce0f01f4a6c3e205f13629.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index c774a92c2..2e0e86653 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -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;