From e3d5da24091bad6043d7eef00f8f297bf1203ab5 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Tue, 4 Sep 2012 19:05:35 +0000 Subject: Fixed a possible race condition in cClientHandle's packet sending code; prepared for moving cSocket out of cClientHandle's ownership. git-svn-id: http://mc-server.googlecode.com/svn/trunk@832 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cClientHandle.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/cClientHandle.cpp') diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index f4f5125c2..06325785e 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -1546,8 +1546,11 @@ void cClientHandle::DataReceived(const char * a_Data, int a_Size) void cClientHandle::GetOutgoingData(AString & a_Data) { // Data can be sent to client - m_OutgoingData.ReadAll(a_Data); - m_OutgoingData.CommitRead(); + { + cCSLock Lock(m_CSOutgoingData); + m_OutgoingData.ReadAll(a_Data); + m_OutgoingData.CommitRead(); + } // Disconnect player after all packets have been sent if (m_bKicking && a_Data.empty()) -- cgit v1.2.3